This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Working with 2 namespaces
- From: Andreas Schlegel <schlegel at software dot b dot uunet dot de>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Mon, 25 Mar 2002 12:14:28 +0100
- Subject: Re: [xsl] Working with 2 namespaces
- References: <3C9E433F.8DB08E0@software.b.uunet.de> <E16pFrW-0003sl-00@pdavis.cx>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Thanks for your help. It works now.
-- Andreas
Peter Davis wrote:
> 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
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list