[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Namespaces: part II

Subject: Namespaces: part II
From: Florent Georges <darkman_spam@xxxxxxxx>
Date: Thu, 6 Apr 2006 00:24:52 +0200 (CEST)
xmlns ns
  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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.