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

RE: Can't Obtain Results

Subject: RE: Can't Obtain Results
From: "Lindy Quick" <lindyq@xxxxxxxx>
Date: Thu, 2 May 2002 15:20:41 -0400 (EDT)
quick text f1

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

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.