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

RE: Copying and transforming/Recursion?

Subject: RE: Copying and transforming/Recursion?
From: Jeff Saylor <JSaylor@xxxxxxxxxxxxxxxxx>
Date: Wed, 11 Oct 2000 10:42:49 -0400
jeff saylor
Sara,

Thanks for the input but unfortunately, this solution requires that I know
the structure inside of <display> ahead of time - what I want is something
more generic like: "copy everything inside of <display>, but update the
@value for any <input>s that it has".

Cheers,

Jeff

-----Original Message-----
From: sara.mitchell@xxxxxxxxx [mailto:sara.mitchell@xxxxxxxxx]
Sent: Tuesday, October 10, 2000 4:21 PM
To: xsl-list@xxxxxxxxxxxxxxxx
Subject: RE: Copying and transforming/Recursion?


This may not be the most elegant, but I think you may want 
to simply do apply-templates instead. For example (untested):

<xsl:template match="display">
<display>
 <xsl:apply-templates/>
</display>
</xsl:template>

... do the same for <p> ...

<xsl:template match="input">
<xsl:element name="input>
 <xsl:apply-templates select="@*"/>
</xsl:element>
</xsl:template>

<!-- recreate the attributes with known values -->
<xsl:template match="input/@type | input/@fieldname">
 <xsl:attribute name="name(.)"><xsl:value-of select="."/>
 </xsl:attribute>
</xsl:template>

<xsl:template match="input/@value">
<xsl:variable name="thisfield" select="."/>
 <xsl:attribute name="name(.)">
 <xsl:value-of select="preceding::submittedValue[@fieldname=$thisfield]"/>
 </xsl:attribute>
</xsl:template>

This should work as long as the submittedValue will always precede the 
input. If not, you may need to use another axis or the "//" selector
although that is much less efficient. 

Sar

> -----Original Message-----
> From: Jeff Saylor [mailto:JSaylor@xxxxxxxxxxxxxxxxx]
> Sent: Tuesday, October 10, 2000 11:45 AM
> To: XSL List (E-mail)
> Subject: Copying and transforming/Recursion?
> 
> 
> Starting with: 
> 
>   <xml>
>     <submittedValues>
>       <submittedValue fieldname='title'>mr.</submittedValue>
>     </submittedValues>
> 
>     <display>
>       <p>
>         title:<input type='text' fieldname='title' value=''/>
>       </p>
>     </display>
>   </xml>
> 
> Effectively, I want to use the <submittedValue>'s text with 
> the matching (by
> @fieldname) <display>'s <input> to get:
>   
>   <display>
>     <p>
>       title:<input type='text' fieldname='title' value='mr.' />
>     </p>
>   </display>
> 
> this involves outputting the <display> tag, and its contents, while
> selectively transforming an element within them - I can not 
> figure out a way
> to do this.  I am thinking copy-of and recursive templates 
> would do the
> trick, but I can't get a grasp on how to do it...
> 
> Much appreciation in advance for any and all input - cheers, 
>   
>   
> Jeffrey J. Saylor 
> Senior Internet Developer 
> Wizard Finance Systems 
> 707 Mendham Blvd., Suite 104 
> Orlando, FL 32825 
> Phone: (407) 262-9000 Ext 266 
> Fax: (407) 262-9010 
> Email: jsaylor@xxxxxxxxxxxxxxxxx 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


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


 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.