| Subject: Re: [xsl] Working with 2 namespaces From: Peter Davis <pdavis152@xxxxxxxxx> Date: Sun, 24 Mar 2002 13:49:13 -0800 | 
On Sunday 24 March 2002 13:21, 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/")?
Can you please post some sample input and output?  There are a dozen possible 
answers, but it is impossible to tell what you really mean.
Either way, though, the answer will likely end up using <xsl:key> and key(), 
so you might investigate those.  Also investigate the local-name() function, 
which will give you the name of an element not including its namespace 
prefix.  If I'm interpreting your question right, you could do this:
<xsl:key name="label" match="/test/common/labels/*" use="local-name(.)"/>
...
<xsl:for-each select="/test/common/fields/*">
  <xsl:value-of select="key('label', local-name(.))"/>
</xsl:for-each>
-- 
Peter Davis
Valerie: Aww, Tom, you're going maudlin on me ...
Tom:	 I reserve the right to wax maudlin as I wane eloquent ...
		-- Tom Chapin
 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
| Current Thread | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| [xsl] Working with 2 namespaces, Andreas Schlegel | Thread | Re: [xsl] Working with 2 namespaces, Andreas Schlegel | 
| Re: [xsl] one line of xml to indent, Peter Davis | Date | Re: [xsl] Working with 2 namespaces, J.Pietschmann | 
| Month |