This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: How to get a value from other node
- From: "Joerg Heinicke" <joerg dot heinicke at gmx dot de>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Thu, 31 Jan 2002 11:25:28 +0100
- Subject: Re: [xsl] How to get a value from other node
- References: <81D0D3538E3CD411AE3C00D0B7474C319B80C0@jadran.hermes.si>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi Aleksander,
you have a little error in your expression:
<xsl:if test="../content/city@name[.='city2']">
has to be either
<xsl:if test="../content/city/@name[.='city2']">
or
<xsl:if test="../content/city[@name='city2']">
Regards,
Joerg
----- Original Message -----
From: "Aleksander Bracko" <aleksander.bracko@hermes.si>
To: <XSL-List@lists.mulberrytech.com>
Sent: Thursday, January 31, 2002 8:55 AM
Subject: [xsl] How to get a value from other node
> I have following XML:
>
> <MyXml>
> <header>
> <location>
> Home
> </location>
> </header>
> <content>
> <city name = "city1">
> <address>
> Address1
> </address>
> </city>
> <city name = "city2">
> <address>
> Address2
> </address>
> </city>
> </content>
> </MyXml>
>
> My XSL looks like this:
>
> <?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
>
> <xsl:template match="/">
> <xsl:apply-templates />
> </xsl:template>
>
> <xsl:template match="header">
> <MyHome>
> <xsl:value-of select="location"/> <------ After this I
> want to insert another value from other node (address)
> </MyHome>
> <xsl:apply-templates />
> </xsl:template>
>
> </xsl:stylesheet>
>
> And now my problem is:
> I would like to insert another value, but from other node. I thought that
i
> could use a line like this one, but it doesn't work
>
> <xsl:if test="../content/city@name[.='city2']">
> <xsl:value-of select="../content/city/address" />
> </xsl:if>
>
> If u could please help me out.
>
> Thanx, Alex
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list