This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Working with 2 namespaces


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]