Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: count some XML nodes >Thread Next - Re: count some XML nodes Re: count some XML nodesTo: NULL Date: 2/1/2006 11:38:00 PM Hi Anthony,
unfortunately the sample above is a simple extract of the hole project
already!
I need the countercariable wich takes values shown above during the
xml-terminal-part file Transformation!
The difficulty in in all is, the order of output elemets is not the
same like the order of elements in xml-source-tree. Therefore many
elements must be stored and concatet with other later elements. After
too days struggle to do it with xsl:variables I have desided yesterday
do built in a javascript. I have read in this newsgroup, that
xsl-experts don't like such stuff, but for my as newbie is no
alternativ at the moment. It works fine now, thanks for your help and
patieance.
Daniel
here is the xsl:counter variable and the script:
<xsl:variable name="ek_counter">
<xsl:choose>
<!-- EK-Terminal found
<xsl:when
test='string-length(substring-before(substring-after(string(Comment),"$EK:"),"$"))!=0'>
<xsl:value-of select="myFun:sortTerminals(2)" />
</xsl:when
<xsl:otherwise>
<xsl:value-of select= "myFun:sortTerminals(3)" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<msxsl:script language="javascript" implements-prefix="myFun">
var counter=0;
function sortTerminals(action)
{
switch (action)
{
case 1:
{
counter=0; // Reset
break;
}
case 2:
{
counter=1; // start new count
break;
}
case 3:
{
counter++ ; // count
break;
}
} //switch
return (counter);
}
</msxsl:script>
</xsl:stylesheet>
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
