Perhaps I've misunderstood the question, but can't you just change
string-length(/) - string-length(translate(/,'
',''))
to
string-length(.) - string-length(translate(.,'
',''))
?
Michael Kay
http://www.saxonica.com/
-----Original Message-----
From: Andreas Peter [mailto:info(_at_)minimag(_dot_)de]
Sent: 20 June 2007 09:47
To: XSL-LIST
Subject: [xsl] problem with xsl:copy-of and counting lines
Hello XSL-List-Users,
I still have a probelm with counting lines in a set of nodes.
I want to count the lines in a specific tree structure. The
xml structure looks like the following:
<block>
<title>Seminare</title>
<h1>Mit gesunden Fuessen laeuft es besser</h1>
<p>text...text...</p>
<list>
<li>Was sagen die Blutzucker-Messwerte aus?</li>
<li>Ist die Krankheit erblich?</li>
</list>
<kursinfo>
<tr>
<referent>
<refname>Seminar mit Hans Wurscht</refname></referent>
</tr>
<tr>
<tag>Do</tag>
<datum>12.06.07</datum>
<uhrzeit>15:00 - 16:30 Uhr</uhrzeit>
<kursnr>Kurs-Nr.:</kursnr>
<nr>10</nr>
<beitrag></beitrag>
</tr>
<tr>
<tag>Fr</tag>
<datum>13.06.07</datum>
<uhrzeit>14:00 - 15:30 Uhr</uhrzeit>
<kursnr>Kurs-Nr.:</kursnr>
<nr>90</nr>
<beitrag></beitrag>
</tr>
<tr><tag>Sa</tag>
<datum>13.06.07</datum>
<uhrzeit>14:00 - 15:30 Uhr</uhrzeit>
<kursnr>Kurs-Nr.: </kursnr>
<nr>68</nr>
<beitrag></beitrag>
</tr>
<tr>
<tag>So</tag>
<datum>13.06.07</datum>
<uhrzeit>14:00 - 15:30 Uhr</uhrzeit>
<kursnr>Kurs-Nr.: </kursnr>
<nr>50</nr>
<beitrag>10 Euro</beitrag>
</tr>
<tr>
<zusatz>
<zusatztext>blabla hier kommt noch zusätzlicher Text hinein, wie
z.B. Handtücher mitbringen usw.</zusatztext>
</zusatz>
</tr>
</kursinfo>
</block>
My aim is to count every line between the element
<block></block> which can occur several times. The returned
value should be stored in a variable which I can use later.
My xsl so far:
<xsl:template match="block" mode="variable"> <xsl:copy-of
select="."/> <xsl:variable name="countlines"
select="string-length(/) -
string-length(translate(/,'
',''))" /> <xsl:value-of
select="."/> </xsl:template>
Counting the lines for the whole document is no problem.
Hope someone out there can help.
Thanks so much.
Andreas
--~------------------------------------------------------------------
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(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
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(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--