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

using node fragments

Subject: using node fragments
From: Woody <woody@xxxxxxxxxxxxxx>
Date: Mon, 14 Apr 2003 15:36:37 +0100
node fragment
I have this section of an xml file that needs to be rendered to a table

<TGROUP>
  <COLSPEC COLNUM="1" COLNAME="1" COLWIDTH="0.713in"/>
  <COLSPEC COLNUM="2" COLNAME="2" COLWIDTH="1.179in"/>
  <COLSPEC COLNUM="3" COLNAME="3" COLWIDTH="1.272in"/>
  <COLSPEC COLNUM="4" COLNAME="4" COLWIDTH="3.283in"/>
  <THEAD>
    <ROW>
      <ENTRY COLNAME="1">Item</ENTRY>
      <ENTRY COLNAME="2">Control</ENTRY>
      <ENTRY COLNAME="3">Selection</ENTRY>
      <ENTRY COLNAME="4">Function</ENTRY>
        </ROW>
        </THEAD>
                ... lots of rows follow here

Problem here is that I need to change the COLWIDTH into percentages to render out to the table.

I started with:

<xsl:variable name="sizes">
<xsl:for-each select="ancestor::TGROUP/COLSPEC[@COLNUM]/@COLWIDTH">
<xsl:sort select="@COLNUM" order="ascending" data-type="number"/>
<xsl:variable name="str" select="."/>
<xsl:choose>
<xsl:when test="contains($str,'in')"><xsl:value-of select="substring($str,1,string-length($str)-2)"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$str"/></xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:variable>


which gets a tree fragment of the sizes which I was then intending to add up and convert to a percentage but hit the problem that it is a tree fragment which I can't do anything useful with.

As far as I can see I have the options of using javascript or node-set() to be able to do anything with these values, both of which are not xslt 1.0 (which is what I was aiming for).
As I want to run this on two separate xsl processors (msxml on the PC and sablotron on the mac) am I stuck with having to have two separate stylesheets for use in this?



Woody



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.