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

Re: Working with 2 namespaces

Subject: Re: Working with 2 namespaces
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Sun, 24 Mar 2002 22:51:03 +0100
andreas pietschmann
Andreas Schlegel wrote:
> I have a "<xsl:for-each select="/test/common/fields/*">" loop.
> For every item in this loop I would refer to an item in another
> namespace ("<xsl:value-of select="/test/common/labels/."/>.
> Both items have the same name but are in different namespaces.
> My problem is: how to get the name of the current item and use it to get
> the corresponding item in the other namespace ("/test/common/labels/")?

I guess you mean there is a corresponding element in
another branch of the tree. Namespace means something
else in an XML context, see, for example
 http://www.dpawson.co.uk/xsl/sect2/N5536.html#d163e21
(there are other sources)

I suppose your XML looks like
 <test>
   <common>
     <fields>
       <foo>stuff</foo>
       <bar>other</bar>
     </fields>
     <labels>
       <foo>foo label</foo>
       <bar>bar label</bar>
     </labels>
   </common>
 </test>
If you want to have the content of the elements with the same
name, try the name() function:
  <xsl:for-each select="/test/common/fields/*">
     <xsl:value-of select="/test/common/labels[name()=name(current())]"/>
  </xsl:for-each>
If you want to have something else, post a relevant snippet
of your XML and how you define the "name of the current item"
and what constitutes the "corresponding item".

HTH
J.Pietschmann


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



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.