xsl-list
[Top] [All Lists]

RE: [xsl] Nested xsl:when

2006-09-25 15:07:19
Hi Danny:

One problem is that in your inner for-each loop, you've included
FormPage/ in the <xsl:value-of select...> statements.

Another is that you've closed your opening for-each loop (second
occurrence) in the opening statement.

Try this instead:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
<xsl:output method="html" />
  <xsl:template match="test/Test_Log/PAO_Compare_Test">          
    <xsl:for-each select="Test_Results">
      <xsl:sort select="FormName"/>
      <xsl:value-of select="FormName"/>
      <xsl:choose>
        <xsl:when test="FormStatus='FAIL'">
          <ab/>
        </xsl:when>
        <xsl:otherwise>
          <cd/>
        </xsl:otherwise>
      </xsl:choose>
      <xsl:for-each select="FormPage">
        <xsl:value-of select="Page" />
        <xsl:value-of select="Code" />
      </xsl:for-each>
    </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>
 
Trish

-----Original Message-----
From: Danny Leblanc [mailto:leblancd(_at_)ca(_dot_)objectiflune(_dot_)com] 
Sent: Monday, September 25, 2006 5:15 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Nested xsl:when

Hello everyone,

  Just a quick question. Are nested xsl:whens permitted in an XSL
transform? I am getting errors raised by both Saxon and Altova XSLT with
the following script (about xsl:when not matching up)

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
<xsl:output method="html" />

  <xsl:template match="test/Test_Log/PAO_Compare_Test">          
    <xsl:for-each select="Test_Results">
      <xsl:sort select="FormName"/>  
      <xsl:value-of select="FormName"/>
      <xsl:choose>
        <xsl:when test="FormStatus='FAIL'">
          <ab/>
        </xsl:when>
        <xsl:otherwise>
          <cd/>
        </xsl:otherwise>
      </xsl:choose>
      <xsl:for-each select="FormPage"/>
        <xsl:value-of select="FormPage/Page"/>
        <xsl:value-of select="FormPage/Code"/>                  
      </xsl:for-each>
    </xsl:for-each>         
  </xsl:template>
</xsl:stylesheet>

  Any thoughts on this would be appriciated.  

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>