[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
At 2004-04-02 14:37 -0500, Alan Stein wrote:
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".
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".
Below is what you asked for ... perhaps this will help you.
................. Ken
<xsl:output method="text"/>
</xsl:template>
</xsl:stylesheet>
T:\ftemp>saxon stein.xml stein.xsl
Re: [xsl] How to specify document order location path for identical elements with different parents?
Subject: Re: [xsl] How to specify document order location path for identical elements with different parents? From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Fri, 02 Apr 2004 15:15:59 -0500 |
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?
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"?
(correct number is 3. Yes, this has been double checked.)
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".
(correct number is 1. Yes, this has been double-checked.)
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>
-- Public courses: Spring 2004 world tour of hands-on XSL instruction Each week: Monday-Wednesday: XSLT/XPath; Thursday-Friday: XSL-FO Hong Kong May 17-21; Bremen Germany May 24-28; Helsinki June 14-18
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] How to specify document o, Andreas L. Delmelle | Thread | RE: [xsl] How to specify document o, Michael Kay |
RE: [xsl] How to specify document o, Andreas L. Delmelle | Date | Re: [xsl] Saxon & Fallback from doc, davidpbrown |
Month |
Keywords