|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: How to specify document order location path for id
At 2004-04-02 14:37 -0500, Alan Stein wrote:
I think I've better articulated my question in the following example: ... How do I perform the following queries? Which is to say that there is a code list with a code "a" where there are no following code lists with a code "b". 2) What is the number of reports which are coded with either an "a" or "b" where the last "a" or "b" code of the report (in document order) is a "b". Which is to say that there is a code list with a code "b" where there are no following code lists with a code "a". Unfortunate that I couldn't apply them to my application because my example was too simplified. Below is what you asked for ... perhaps this will help you. ................. Ken T:\ftemp>type stein.xml
<?xml version="1.0" encoding="UTF-8"?>
<reportlist>
<report>
<codelist>
<code type="a"/>
</codelist>
<codelist>
<code type="b"/>
<code type="c"/>
</codelist>
</report>
<report>
<codelist>
<code type="a"/>
<code type="b"/>
</codelist>
<codelist>
<code type="a"/>
</codelist>
</report>
<report>
<codelist>
<code type="z"/>
<code type="a"/>
<code type="d"/>
</codelist>
</report>
<report>
<codelist>
<code type="a"/>
<code type="e"/>
<code type="f"/>
</codelist>
</report>
<report>
<codelist>
<code type="e"/>
</codelist>
</report>
</reportlist>T:\ftemp>type stein.xsl
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"><xsl:output method="text"/> <xsl:template match="/">
1) What is the number of reports which are coded with either an "a" or
"b" where the last "a" or "b" code of the report (in document order)
is an "a"? <xsl:value-of select="
count(/*/report[codelist/code[@type='a']
[not(../following-sibling::codelist/code/@type='b')]])"/>
2) What is the number of reports which are coded with either an "a" or
"b" where the last "a" or "b" code of the report (in document order)
is a "b"? <xsl:value-of select="
count(/*/report[codelist/code[@type='b']
[not(../following-sibling::codelist/code/@type='a')]])"/></xsl:template> </xsl:stylesheet> T:\ftemp>saxon stein.xml stein.xsl 1) What is the number of reports which are coded with either an "a" or
"b" where the last "a" or "b" code of the report (in document order)
is an "a"? 3
2) What is the number of reports which are coded with either an "a" or
"b" where the last "a" or "b" code of the report (in document order)
is a "b"? 1
T:\ftemp>
World-wide on-site corporate, govt. & user group XML/XSL training. G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








