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

Count a substring of an attribute in childnodes

Subject: Count a substring of an attribute in childnodes
From: "Ragulf Pickaxe" <jawxml@xxxxxxxxxxx>
Date: Wed, 09 Mar 2005 10:45:40 +0000
count childnodes
Hi all,

I am trying to transform CALS tables to HTML in one pass.

To this, I need the total number of all colwidth attributes that contains a *.

The following XML snippet should give me a total of 600.

<?xml version="1.0"?>
<tgroup cols="3" colsep="0" rowsep="0" align="left">
<colspec colname="1" colwidth="100*" />
<colspec colname="2" colwidth="200*" />
<colspec colname="3" colwidth="300*" />
</tgroup>

I have tried with

<?xml version="1.0"?>
<xsl:stylesheet
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	version="1.0">

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

<xsl:template match="tgroup">
<xsl:variable name="total-colwidth" select="'count(number(colspec[contains(@colwidth,'*')]/substring-before(@colwidth,'*')))'"/>
<Output><xsl:value-of select="$total-colwidth"/></Output>
</xsl:template>


</xsl:stylesheet>

But this one gives me <Output>NaN</Output>

What am I doing wrong?

Regards,
Ragulf Pickaxe :-|

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


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.