Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: count some XML nodes

From: "Daniel Bohn" <d.bohn@-------.-->
To: 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>



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent