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

RE: Contitional statement

Subject: RE: Contitional statement
From: "Earl Spencer" <eapencer74@xxxxxxxxxxx>
Date: Wed, 13 Jun 2001 16:04:09 -0000
contitional get
Hi Kay,

       Sorry if i am ignorant i am new to xslt my actual problem is
i have an xml file like this

<ROOT>
<root2>
<a>texta</a>
<b>textb</b>
<c>c one</c>
<c>ctow</c>
<id>1</id>
</root2>
<root2>
<a>texta</a>
<b>textb</b>
<c>cs</c>
<c>css</c>
<id>1</id>
</root2>
<root2>
<a>texta</a>
<b>textb</b>
<c>c one</c>
<c>ctow</c>
<id>2</id>
</root2>
<root2>
<a>texta</a>
<b>textb</b>
<c>c one</c>
<c>ctow</c>
<id>3</id>
</root2>

</ROOT>

i want to get an output like this

<ROOT>
<id idn=1>
<a> appears only once for one id
<b> appears only once for one id
<c>c one</c>
<c>ctow</c>
<c>cs</c>
<c>css</c>
<id>

what is the best way to do this


From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: RE:  Contitional statement
Date: Wed, 13 Jun 2001 10:52:07 +0100

> > <xsl:value-of select="ROW/KEY[id=$var]"/>
> > is this right to use....
> This is correct XSL-T, but the result might not be what you expect:
>
> input:
> <row>
> <key id="foo">foo1</key>
> <key id="bar">bar1</key>
> <key id="foo">foo2</key>
> <key id="bar">bar2</key>
> </row>
>
> <xsl:variable name="var">foo</xsl:variable>
> <xsl:value-of select="row/key[id=$var]"/>
>
> will result in:
>
> "foo1 foo2"
>
Wrong. It will result in "foo1". <xsl:value-of>, given a node-set, takes the
string value of the first node.


Mike Kay
Software AG


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



_________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com


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.