RE: [xsl] Value of attribute starts-with or contains

Subject: RE: [xsl] Value of attribute starts-with or contains
From: "Pankaj Chaturvedi" <pankaj.chaturvedi@xxxxxxxxx>
Date: Fri, 6 Jun 2008 12:11:48 +0530
<xsl:value-of select="count(.//entry[starts-with(@aid5:cellstyle,
'tbody_cell')])"/>

Or if you want to match those special cells:
<xsl:template match="entry[starts-with(@aid5:cellstyle, 'tbody_cell')]">
</xsl:template>


Thanks Michael. I will look into it and will revert, if
any concerns. Though
I've done it other way around, but certainly thanks for
help.



 

I just learned about the -- very old and long-existing, but
I never had to
use it -- function starts-with() by browsing Michael Kays
wonderful (and
heavy) Reference ("The Book").

Am 05.06.2008 um 09:52
schrieb Michael M|ller-Hillebrand:

> I guess you want something like
>
>
count(.//entry[contains(@aid5:cellstyle, 'tbody_cell')])
>
> - Michael
>
>
PS: This just checks for "contains" and not "begins with".

<xsl:value-of
select="count(.//entry[starts-with(@aid5:cellstyle,
'tbody_cell')])"/>

Or
if you want to match those special cells:

<xsl:template
match="entry[starts-with(@aid5:cellstyle, 'tbody_cell')]">
</xsl:template>
In your original post you mention looking for ;contains or starts- with+.
Since starts-with is a subset of contains, there is no use of checking both.
You either want contains() or you want starts-with().

The above works with
XSLT 1 or 2 for your markup:

>> <table>
>> <thead>
>> <entry
aid5:cellstyle=tbody_cell">
>> <para>xxx</para>
>> </entry>
>> <entry
aid5:cellstyle=tbody_cell">
>> <para>xxx</para>
>> </entry><entry
aid5:cellstyle=tbody_cell_l"> <para>xxx</para> 
>> </entry><entry
aid5:cellstyle=tbody_cell_l"> <para>xxx</para> 
>> </entry> </thead> </table>
>>
>> All I am trying to do is while in <table> trying to count the nos 
>>
entry whose @aid5:cellstyle contains or starts-with tbody_cell.
>>
>>
Believe me I've used these functions lots of time mostly with nodes, 
>> but
nothings seems to be working with attributes. May be I never 
>> tested
"attribute values" with these functions.
>>
>> Any clue will be highly
appreciated.

HTH,

- Michael



--
_______________________________________________________________
Michael
M|ller-Hillebrand: Dokumentation Technology Adobe Certified Expert,
FrameMaker Consulting and Training, FrameScript, XML/XSL, Unicode Blog [de]:
http://cap-studio.de/
--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To
unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>
--~--
Confidentiality Notice:" This message and any attachment(s)
contained here are
information that is confidential, proprietary to
IDS Infotech Ltd. and its
customers.
Contents may be privileged or otherwise protected by law. The
information is solely intended for the individual or the entity it
is
addressed to. If you are not the intended recipient of this
message, you are
not authorized to read, forward, print, retain,
copy or disseminate this
message or any part of it. If you have
received this e-mail in error, please
notify the sender immediately
by return e-mail and delete it from your
computer."

Current Thread