This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

How to use copy-of with variable? (RE: How to code XSL to display two XML elements side by side?)


> > How can I code XSL to combine the two XML elements, display one
> > in the left and one in the right columns in the <table> element?  
> 
> No magic here, just
> <td><xsl:value-of select="soldto/lastname"/></td>
> <td><xsl:value-of select="shipto/lastname"/></td>
> and so on.

Thanks Mike :)  That's exactly what I needed here :)
 
> > 	Another question, I need to reuse the ShipTo info to 
> > reprint it at bottom of the HTML.  How can I code XSL so that I can
> > reprint ShipTo info at bottom of the HTML page?
> > 
> Several possibilities:
> (a) just access the data a second time, using "pull" logic 
> (xsl:for-each, xsl:value-of)
> (b) process the data using xsl:apply-templates ("push" logic) 
> and use a different mode
> (c) write a named template to do the formatted and call it 
> from both places
> (d) write a global variable to contain the formatted data as 
> a result tree fragment, and reference the variable from both places.

The display logic at the two places are little different.  I see (b) and (d)
should work for my situation, I just don't know how to use them :(
I tried to use (d) like the following:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<!-- get a copy of shipto element -->
<xsl:variable name="ShipTo">
<xsl:copy-of select="/pick/addressinfo/shipto"/>
</xsl:variable>
......

IE5 respond with "Keyword xsl:variable may not be used here."  What I did
wrong here?  Also, when I use it, can I just use it like the following?
<xsl:value-of select="ShipTo/firstname" />

Much thanks,

Xiaocun Xu
mailto:xxu@commercialware.com


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept
for the presence of computer viruses.

WIN $1,000,000 !
WWW.COMMERCIALWARE.COM

**********************************************************************


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]