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

Re: Transformation of generic spreadsheet XML

Subject: Re: Transformation of generic spreadsheet XML
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 19 Apr 2001 22:12:27 +0100
generic xsl pretty xml
Hi Xiaocun,

> Very much appreciated for the well detailed answer :)

My pleasure.

>> I think you'd be better off storing the bidHeader row in a global
>> variable (assuming that the row elements are children of a 'rows'
>> document element here):
>> <xsl:variable name="bidHeader" select="/rows/row[1]" />
> Sorry I did not provide the whole picture in my original post (it
> was already pretty long :(). The actual source XML had many rows
> before the $bidHeader row, therefore the bid header row does not
> have exact position among its siblings. So my XSL had to catch that
> bid header row and process all following siblings as follows:
> <xsl:template match="row" mode="createBids">
>   <RFQRequest>
>     <xsl:element name="createBids">
>       <xsl:apply-templates
> select="following-sibling::row" mode="BidsDetail"/>
>     </xsl:element>
>   </RFQRequest>                         
> </xsl:template>
> <xsl:template match="row" mode="BidsDetail">
>   <xsl:if test="string(cell[1]) = string('BidType') or
> substring(cell[1],2) = string('BidType')">
>     <xsl:variable name="bidHeader" select="."/>
> ......

You don't need to use the string() function to convert strings to
strings - string('BidType') is *exactly* the same as 'BidType'.  Also,
you don't have to convert cell[1] to a string explicitly - it's being
compared to a string ('BidType') so it'll automatically be converted
to a string for the comparison.

So your test in the above is exactly the same as:

  cell[1] = 'BidType' or substring(cell[1], 2) = 'BidType'

But even with the fact that you can't just get the *first* row, I
think you could still store that particular row as a global variable

<xsl:variable name="row"
              select="/rows/row[cell[1] = 'BidType' or
                                substring(cell[1], 2) = 'BidType']" />

This selects the row where the value of the first cell is 'BidType' or
where the substring of the value of that first cell after the first
character is 'BidType'.

I hope that helps,


Jeni Tennison

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

Current Thread


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.
First Name
Last Name
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.