|
Subject: RE: [xsl] Can't Obtain Results From: "Lindy Quick" <lindyq@xxxxxxxx> Date: Thu, 2 May 2002 15:20:41 -0400 (EDT) |
This is a repost to my previous messages. I have had to replace the greater than sign with the # sign so it can be sent through this mail client. Also I have added an example of the code I have been trying to use. Thanks in advance
Hello,
Here's my the situation:
I have an XML or tree the looks like this:
#root>
#keyset>
#f1>some text#/f1>
#f2>some text#/f2>
#f3>some text#/f3>
#f6>some text#/f6>
#/keyset>
#keyset outlet="cb">
#f2>SOMETEXT#/f2>
#f3>SOMETEXT#/f3>
#f4>SOMETEXT#/f4>
#f5>SOMETEXT#/f5>
#/keyset>
#/root>
I am passing in a parameter called outlet
If the outlet parameter is "cb" - after transformation I want it to look like this:
#root>
#keyset>
#f1>some text#/f1>
#f2>SOMETEXT#/f2>
#f3>SOMETEXT#/f3>
#f4> SOMETEXT#/f4>
#f5> SOMETEXT#/f5>
#f6>some text#/f6>
#/keyset>
#/root>
If the outlet parameter is "default" - after transformation I want it to look like this:
#root >
#keyset >
#f1>some text#/f1>
#f2>some text#/f2>
#f3>some text#/f3>
#f6>some text#/f6>
#/keyset>
#/root>
I have tried several different approches with for-each statements etc, but have been unable to achieve my results. This is my
most recent attempt and I get close, but I can't figure out how to determine if I have already found a match.
#xsl:template match="/">
#xsl:param name="outlet">cb#/xsl:param>
#xsl:variable name="k1" select="/root/keyset[@outlet=$outlet]/*"/>
#xsl:for-each select="/root/keyset[@outlet='default']/*">
#xsl:variable name="dflt" select="."/>
#xsl:for-each select="$k1">
#xsl:choose>
#xsl:when test="name($dflt)= name(.)">
#xsl:copy-of select="."/>
#/xsl:when>
#xsl:when test="not(name(@dflt)=name(.)) and position()=last()">
#xsl:copy-of select="$dflt"/>
#/xsl:when>
#/xsl:choose>
#/xsl:for-each>
#/xsl:for-each>
#/xsl:template>
Thanks
Lindy
------------------------------------------------
Visit iWon.com - the Internet's largest guaranteed cash giveaway!
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Can't Obtain Results, Lindy Quick | Thread | Re: [xsl] Can't Obtain Results, Jeni Tennison |
| [xsl] <xsl:for-each> Looping help p, Zoe Peng | Date | Re: [xsl] Convert String to node-se, J.Pietschmann |
| Month |