|
Subject: RE: [xsl] My Difficult counting problem From: "Hunsberger, Peter" <Peter.Hunsberger@xxxxxxxxxx> Date: Thu, 22 Aug 2002 17:07:11 -0500 |
> I need some help doing the following, I can't seem to figure out how to do
> this in XSL
>
> I need to convert something like this
> <myElement>
> <foo name="foobar1"/>
> <foo name="foobar2"/>
> <foo name="foobar1"/>
> <foo name="foobar3"/>
> <foo name="foobar1"/>
> <foo name="foobar1"/>
> <foo name="foobar3"/>
> </myElement>
>
> and the output after running it through the XSL would be
>
> numberOccurrences[] = {1, 1, 2, 1, 3, 4, 2};
<xsl:template match="myElement">
numberOccurances[] = {
<xsl:for-each select="foo">
<xsl:value-of select="count(preceding-sibling::*[@name =
current()/@name])+1"/>
<xsl:if test="position() < last()">, </xsl:if>
</xsl:for-each>
};
</xsl:template>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] My Difficult counting pro, Mike Brown | Thread | RE: [xsl] My Difficult counting pro, Girard Tim-TGIRARD1 |
| [xsl] My Difficult counting problem, Girard Tim-TGIRARD1 | Date | Re: [xsl] My Difficult counting pro, Jeni Tennison |
| Month |