Subject: RE: [xsl] need help with XSL statement (location path parenthesis problem) From: "Andrew Welch" <AWelch@xxxxxxxxxxxxxxx> Date: Mon, 29 Mar 2004 14:17:09 +0100 |
I'm not sure your '*correct number is x*' statements match the example xml you have provided, but 2 xpaths that meet your description are: <xsl:value-of select="count(report[code/@type = 'a' or code/@type = 'b'][code[last()]/@type = 'a'])"/> and <xsl:value-of select="count(report[code/@type = 'a' or code/@type = 'b'][code[last()]/@type = 'b'])"/> Respectively (when the template is processing <reportlist>). Are you sure about the xml you've posted? Andrew > Hi, > I have small XSL example which is posing rather large > difficulty... I think due to the use of parenthesis needed > for document order location path. Is there an XML guru that > can help me with the correct statement > for the example below? Thanks in advance. > --Alan > > > In the following XML document, I need to be able to query the > following: > > 1) The number of reports which are coded with either an "a" > or "b" where the last code (in document order) which is > either an "a" or "b" is an "a". > > *correct number is 3 * > > > 2) The number of reports which are coded with either an "a" > or "b" where the last code (in document order) which is > either an "a" or "b" is a "b". > > *correct number is 1* > > > <?xml version="1.0" encoding="UTF-8"?> > <reportlist> > <report> > <code type="a"/> > <code type="b"/> > <code type="c"/> > </report> > <report> > <code type="a"/> > <code type="b"/> > <code type="a"/> > </report> > <report> > <code type="z"/> > <code type="a"/> > <code type="d"/> > </report> > <report> > <code type="a"/> > <code type="e"/> > <code type="f"/> > </report> > <report> > <code type="e"/> > </report> > </reportlist>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] need help with XSL statement , Alan Stein | Thread | RE: [xsl] need help with XSL statem, Jarno.Elovirta |
[xsl] need help with XSL statement , Alan Stein | Date | RE: [xsl] need help with XSL statem, Jarno.Elovirta |
Month |