xml - XSLT Advance a node without using for-each -


pretty green on xslt , 1 of systems i'm working on using generate tables on front end. performing query against db2 instance result set being parsed xml , output similar to...

<resultset>     <row>         <node1></node1>         <node2></node2>         <etc>     </row>     <row>     </row> </resultset> 

i'm wondering how advance node without being required use for-each loop. understanding of variables inside of xslt (which limited).

at end of page have create table using variables create above. assumed of result set return 3 rows , no more/less. of code xslt follows...

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform">     <xsl:output method="html"/>     <xsl:template match="/">     ....after html population...     <tbody>         <tr>             <td>column</td>                 <td class="rightaligned">                     <xsl:call-template name="formatascurrencynodecimals">                         <xsl:with-param name="numbertoformat"                              select="summarizedloads/summary/total" />                     </xsl:call-template>                 </td>                 .....xsl continues row.... 

once done needs done advance next row? though have modify root template match <xsl:template match="/summarizedloads/"> , call after each row.

inside of each row i'll need creating several variables use @ end.

also rows contain same amounts of data. clear i'm trying , if else needed me please let me know.

the sweet spot in xslt when use nested templates. you've got 1 template already; let's make 1 below 1 have match = "row". in template, row-specific stuff. call within main template (match = "/") want final rows so:

<xsl:apply-templates select = "./row[0]"/> <xsl:apply-templates select = "./row[1]"/> <xsl:apply-templates select = "./row[2]"/> 

if wanted rows instead of first 3, instead:

<xsl:apply-templates select = "./row"/> 

the dot stands current element. since we're in main template, that's root element resultset. /row means we're applying first template matches row descendant row elements.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -