|
Subject: [xsl] Namespaces: part II From: Florent Georges <darkman_spam@xxxxxxxx> Date: Thu, 6 Apr 2006 00:24:52 +0200 (CEST) |
Hi
I have a new question about XSLT and namespaces. I use a
custom document type to generate XSLT scripts. This source
document contains XPath expressions that are copied in the
resulting script, for example:
<doc>
...
<text select="an/xpath/expression"/>
...
</doc>
may result in something like:
<xsl:transform ...>
...
<xsl:value-of select="an/xpath/expression"/>
...
</xsl:transform>
But the source document against wich the generated script
will be applied has element in multiple namespaces. So it
is like this:
<doc xmlns:ns1="ns/1" xmlns:ns2="ns/2" xmlns:ns3="ns/3">
...
<text select="ns1:an/ns2:xpath/ns3:expression"/>
...
</doc>
and:
<xsl:transform xmlns:ns1="ns/1" xmlns:ns2="ns/2"
xmlns:ns3="ns/3" ...>
...
<xsl:value-of select="ns1:an/ns2:xpath/ns3:expression"/>
...
</xsl:transform>
How can I ensure that the same prefixes will be bound to
the same namespace URI in the generated XSLT ?
I guess that with something like this:
<doc>
<ns prefix="ns1" uri="ns/1"/>
<ns prefix="ns2" uri="ns/2"/>
<ns prefix="ns3" uri="ns/3"/>
...
<text select="ns1:an/ns2:xpath/ns3:expression"/>
...
</doc>
I can add the right bindings to the xsl:transform. But I
wonder if it is possible to keep the usual namespace rules
in the source document (using xmlns declarations), and to
keep scope-correctness. By this last point, I mean for
example:
<doc>
...
<text select="1 + 1"/>
<text select="ns:element" xmlns:ns="ns/uri"/>
...
</doc>
and:
<xsl:transform ...>
...
<xsl:value-of select="1 + 1"/>
<xsl:value-of select="ns:element" xmlns:ns="ns/uri"/>
...
</xsl:transform>
Thanks for your help. Regards,
--drkm
___________________________________________________________________________
Nouveau : tiliphonez moins cher avec Yahoo! Messenger ! Dicouvez les tarifs exceptionnels pour appeler la France et l'international.
Tilichargez sur http://fr.messenger.yahoo.com
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Man Page Transform and Mo, Michael Kay | Thread | RE: [xsl] Namespaces: part II, Michael Kay |
| RE: [xsl] Bottom border missing whe, G. Ken Holman | Date | Re: [xsl] Man Page Transform and Mo, Jon Gorman |
| Month |