[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XSL questions
> 1) how to embed html tags in a XML which will be processed by XSL? XSLT deals with elements (a parsed node tree) rather than tags, but you just generate those nodes by putting the tags as literal result elements in your stylesheet, they have to be well formed xml though, so <br>/> not <br> <xsl:template match="title"> <h1>....</h1> ... will make an h1 element. > 2) Counter inside of xsl:for-each > > With the xsl:choose tag inside of xsl:for-each tag, I need to count the number of nodes met the condition. How to set up the counter? > The number of nodes in the node set that xsl:for-each is iterating over is available as the function last(). > 3) Flag inside of xsl:for-each > > With the xsl:if tag inside of xsl:for-each tag, I need to know whether > a node met the condition by the end of the loop. How to set up the > flag variable? You don't need a variable just select the nodes that meet the condition select="...[condition]" if there are no nodes that meet the condition then the node set will be empty and so test as false. You seem to be thinking procedurally an thinking that the for-each will be executed in a certain order, that isn't the case the code is executed for each item selected but may be in any order, or in particular in parallel. The results of each iteration are merged in a specified order but that does not imply an execution order, so you can't make the processing of one item in the sequence depend on the result of processing a different one. David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|