[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Namespaces: part II
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|