Subject: RE: [xsl] position of an element From: Sebastian Schirmer <schirmer@xxxxxxxxxxxxx> Date: Fri, 25 May 2001 17:50:10 +0200 |
-----Ursprüngliche Nachricht----- Von: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]Im Auftrag von Michael Kay Gesendet: Freitag, 25. Mai 2001 14:16 An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Betreff: RE: [xsl] position of an element >> <template match="content"> >> <xsl:value-of >> select="position-of-this-element-in-the-document()" /> >> </template> >> > You can use xsl:number, or count(preceding-sibling::*)+1 Ok, xsl:number works for the little example I gave above, but in fact my XML looks like this: --- snip -- <xmltable> <row> <data><content key="string"></data> <data><content key="image"></data> <data><content key="string"></data> </row> <row> <data> <xmltable> <row> <data><content key="image"></data> <data><content key="image"></data> <data><content key="string"></data> </row> <xmltable> </data> </row> </xmltable> --- snip --- That means if I wanted to count/number the content elements, <xsl:number level="any" /> would output the correct result. Now I want to count the content elements with key="string", then the ones with key="image" etc. I could make a <xsl:template match="content[@key = 'string']> and then <xsl:number as shown above and it would work as well. But I want <xsl:template match="content">, not specified with the key attribute value. Inside this template I need the number/count of the content elements with the specific key attribute values, for example: "This is the third content element with key=string in the document." "This is the fifth content element with key=image in the document." Thanks Sebastian Schirmer XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] position of an element, Michael Kay | Thread | RE: [xsl] position of an element, Wendell Piez |
[xsl] Cascading Attributes?, William Bagby | Date | Re[2]: [xsl] Problem with key(), Kevin Burges |
Month |