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 |
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.)
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.)
Unfortunate that I couldn't apply them to my application because my example was too simplified.
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: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')]])"/>
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 |