[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Noob: how to use "for each" in this context?

Subject: Noob: how to use "for each" in this context?
From: "Barry van Weldam" <barry@xxxxxxx>
Date: Wed, 17 Sep 2003 10:29:22 +0200
border collapse xsl
Hi,

I realised i am repeating this code in my .xsl:
------------------------------------------
     <fo:table-cell border="solid black 1 px" border-collapse="collapse">
         <fo:block>
          <xsl:choose>
         <!--Here we put nothing if nodevalue=null -->
          <xsl:when test='($node="null")'></xsl:when>
        <!--or the value-->
         <xsl:otherwise><xsl:value-of select="$node"/></xsl:otherwise>
          </xsl:choose>
         </fo:block> 
     </fo:table-cell>
------------------------------------
Now i want to use a for each, how do i do that?



BTW:
My .xml
--------------------------------------------------------
<Root>
<Table>
<Row>
<nodeA>Total</nodeA>
<node1>null</node1>
<node2>777</node2>
etc

and this is the part of the .xsl i want to streamline


------------------------------------------------------------------------------
 <xsl:template match="//Row">
    <fo:table-row>
     <fo:table-cell border="solid black 1 px" border-collapse="collapse">
         <fo:block>
            <xsl:value-of select="nodeA"/></fo:block> 
     </fo:table-cell> 
     <fo:table-cell border="solid black 1 px" border-collapse="collapse">
         <fo:block>
         <xsl:choose>
         <!--Here we put nothing if nodevalue=null -->
          <xsl:when test='(node1="null")'></xsl:when>
          <xsl:otherwise><xsl:value-of select="node1"/></xsl:otherwise>
         </xsl:choose>
           
         </fo:block> 
     </fo:table-cell>
     <fo:table-cell border="solid black 1 px" border-collapse="collapse">
         <fo:block>
          <xsl:choose>
         <!--Here we put nothing if nodevalue=null -->
          <xsl:when test='(node2="null")'></xsl:when>
        <xsl:otherwise> <xsl:value-of select="node2"/></xsl:otherwise>
        </xsl:choose>
         </fo:block> 
     </fo:table-cell>
     <fo:table-cell border="solid black 1 px" border-collapse="collapse">
         <fo:block>
          <xsl:choose>
         <!--Here we put nothing if nodevalue=null -->
          <xsl:when test='(node3="null")'></xsl:when>
        <xsl:otherwise> <xsl:value-of select="node3"/></xsl:otherwise>
        </xsl:choose> 
        </fo:block>
     </fo:table-cell> 
     <fo:table-cell border="solid black 1 px" border-collapse="collapse">
         <fo:block>
          <xsl:choose>
         <!--Here we put nothing if nodevalue=null -->
          <xsl:when test='(node4="null")'></xsl:when>
         <xsl:otherwise><xsl:value-of select="node4"/></xsl:otherwise>
         </xsl:choose>
         </fo:block> 
     </fo:table-cell>
     <fo:table-cell border="solid black 1 px" border-collapse="collapse">
         <fo:block>
          <xsl:choose>
         <!--Here we put nothing if nodevalue=null -->
          <xsl:when test='(node5="null")'></xsl:when>
         <xsl:otherwise><xsl:value-of select="node5"/></xsl:otherwise>
          </xsl:choose>
         </fo:block> 
     </fo:table-cell>
     <fo:table-cell border="solid black 1 px" border-collapse="collapse">
         <fo:block>
          <xsl:choose>
         <!--Here we put nothing if nodevalue=null -->
          <xsl:when test='(node6="null")'></xsl:when>
        <xsl:otherwise> <xsl:value-of select="node6"/></xsl:otherwise>
          </xsl:choose>
         </fo:block> 
     </fo:table-cell> 
     <fo:table-cell border="solid black 1 px" border-collapse="collapse">
         <fo:block>
          <xsl:choose>
         <!--Here we put nothing if nodevalue=null -->
          <xsl:when test='(node7="null")'></xsl:when>
         <xsl:otherwise><xsl:value-of select="node7"/></xsl:otherwise>
          </xsl:choose>
         </fo:block> 
     </fo:table-cell>
     <fo:table-cell border="solid black 1 px" border-collapse="collapse">
         <fo:block>
          <xsl:choose>
         <!--Here we put nothing if nodevalue=null -->
          <xsl:when test='(node8="null")'></xsl:when>
         <xsl:otherwise><xsl:value-of select="node8"/></xsl:otherwise>
          </xsl:choose>
         </fo:block> 
     </fo:table-cell>
     <fo:table-cell border="solid black 1 px" border-collapse="collapse">
         <fo:block>
          <xsl:choose>
         <!--Here we put nothing if nodevalue=null -->
          <xsl:when test='(node9="null")'></xsl:when>
         <xsl:otherwise><xsl:value-of select="node9"/></xsl:otherwise>
          </xsl:choose>
         </fo:block> 
     </fo:table-cell>
     <fo:table-cell border="solid black 1 px" border-collapse="collapse">
         <fo:block>
          <xsl:choose>
         <!--Here we put nothing if nodevalue=null -->
          <xsl:when test='(node10="null")'></xsl:when>
         <xsl:otherwise><xsl:value-of select="node10"/></xsl:otherwise>
          </xsl:choose>
         </fo:block> 
     </fo:table-cell> 
     <fo:table-cell border="solid black 1 px" border-collapse="collapse">
         <fo:block>
          <xsl:choose>
         <!--Here we put nothing if nodevalue=null -->
          <xsl:when test='(node11="null")'></xsl:when>
         <xsl:otherwise><xsl:value-of select="node11"/></xsl:otherwise>
          </xsl:choose>
         </fo:block> 
     </fo:table-cell>
     <fo:table-cell border="solid black 1 px" border-collapse="collapse">
         <fo:block>
          <xsl:choose>
         <!--Here we put nothing if nodevalue=null -->
          <xsl:when test='(node12="null")'></xsl:when>
         <xsl:otherwise><xsl:value-of select="node12"/></xsl:otherwise>
          </xsl:choose>
         </fo:block> 
     </fo:table-cell>
    </fo:table-row>

------------------------------------------------


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.