This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: xpath problem


> for this file i used an expression this way
>
> <xsl:for-each select="a">
> <xsl:variable name="mcid"><xsl:value-of select="@mcID"/></xsl:variable>
> <xsl:value-of select="count(b[contains(new,text())])"/>
>
> this gives me a correct value

If this gives you the right answer, it's by chance.

I don't know what the variable mcid is for. You don't have an attribute
called @mcID in your XML source, so it can't be very useful. If it meant
anything, you should probably have written
<xsl:variable name="mcid" select="@mdID"/>

The expression
count(b[contains(new,text())])

counts the number of child <b> elements that have a child element called
<new> whose string-value contains (as a substring) the value of the first
text node child of the <b> element. Since none of your <b> elements have a
child called <new>, this is the same as writing contains("", text()), which
will be true if and only if the <b> element has no text node children.

P.S. Pardon my asking, but is "Earl Spencer" your real name?

Mike Kay
Software AG


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]