list4xt : Mailing list for the XT users community.
[list4xt] Re: XSLT with a source with namespaces
Subject: [list4xt] Re: XSLT with a source with namespaces
User: Website From: Stephanie Martin - Contractor (SMartin@agchem.com)
Date: 30/06/2000 - 20:38
>The only thing that uniquely identifies a namespace is the URI. It is the
>prefixes that are meant to be interchangeable. Two elements are not
>necessarily in the same namespace if they have the same prefix. I don't
>always like it, either, but it does make sense; I'd hate for someone else
>to come along and say that the prefix I've been using identifies their
>namespace, not mine.
Now that you put it that way, it makes a lot more sense. Thanks for
the excellent explanation.
>Namespace nodes for the XSLT namespace and extension namespaces are *not*
>copied to the result tree for literal result elements, per the XSLT spec.
>XSLT also lets you specify what namespaces you don't want the nodes for to
>be copied over, via the exclude-result-prefixes attribute on the
>stylesheet element. This functionality is described in section 7.1 of the
>XSLT spec.
I changed my xsl:stylesheet element to this:
<xsl:stylesheet
xmlns:xsl="<http://www.w3.org/1999/XSL/Transform>"
version="1.0"
xmlns:xt="<http://www.jclark.com/xt>"
extension-element-prefixes="xt"
xmlns:n1="x-schema:schema/schema-n1.xml"
xmlns:n2="x-schema:schema/schema-n2.xml"
xmlns:n3="x-schema:schema/schema-n3.xml"
exclude-result-prefixes="n1, n2, n3"
>
And now I got the error I started out with before I put the
namespace
declarations in. Namely, an "TransformException" with the message
"undefined prefix". It doesn't seem to be working even though the
documentation for XT says it should. Clues?
>Watch what happens when you use xsl:element instead of literal result
>elements. Poof! No more 'extraneous' namespace declarations.
Whenever I see examples of XSLT in use, 99% of them use literal
result elements vs. using xsl:element. The same applies to
xsl:attribute and others like it. Is there a "best practice"
detail here that I should know about or is it whatever you feel
like typing (or odd circumstances like mine)?
I've also noticed a couple differences in declaring namespaces.
One is this (specifically naming the namespace, not a default):
<n1.document xmlns:n1="x-schema:schema/schema-n1.xml">
The other is this:
<n1.document xmlns="x-schema:schema/schema-n1.xml">
Which is correct? Do they do the same thing?
>I hope this helps.
> - Mike
This helps a TREMENDOUS amount. You've just made sense of half the reading
I've
done over the last week! Thanks for being so clear, concise, and patient
with
learners such as myself.
--
Mailing list for the XT users community. (http://onewayadultlinks.com)
(mailto:list4xt-request@4xt.org?Subject=unsubscribe to unsubscribe)
Archive générée par hypermail 2b28 le 06/11/2001 - 11:46 CET
webmaster@4xt.org
|