Subject: Re: XSL count function.
From: Gang Li <g_li@xxxxxxxxx>
Date: Thu, 3 Mar 2005 14:29:33 -0800 (PST)
|
Try
<xsl:value-of select="count(file[@type="txt"])"/>
or
<xsl:value-of select="count(file[@type="'txt'"])"/>
Your syntax is correct but I think it has something to do with string
comparison here.
--- c p <bugs75il@xxxxxxxxx> wrote:
> Hello,
>
> I have a XML file (see below) with a "file" nodes and
> I want to get a count of file nodes based on certain
> attributes. I am using XSLT transformations on the
> XML to put them into HTML.
>
> Here is the XML:
> ---------------------------------------------------
> <file type="txt" path="...."/>
> <file type="txt" path="...."/>
> <file type="doc" path="....."/>
> <file type="html" path="...."/>
> ---------------------------------------------------
>
> End result I want displayed on the screen is something
> like this:
> ---------------------------------------------------
> txt files: count = 2
> doc files: count = 1
> html files: count = 1
> total files: count = 4
>
> How would I get this? I can get the total file count
> by using: <xsl:value-of select="count(file)"/>.
>
> To get the individual file counts I did something like
> this: <xsl:value-of
> select="count(file[@type='txt'])"/> but it errored on
> me.
>
> Any ideas?
>
> Thanks,
> C
| Current Thread |
- XSL count function.
- c p - 3 Mar 2005 22:07:56 -0000
- <Possible follow-ups>
- Gang Li - 3 Mar 2005 22:29:54 -0000 <=
- Anthony - 4 Mar 2005 00:02:09 -0000
- Gang Li - 3 Mar 2005 23:04:56 -0000
|
|