Re: xsl structuring....

Subject: Re: xsl structuring....
From: Gary L Peskin <garyp@xxxxxxxxxxxx>
Date: Mon, 02 Oct 2000 19:11:43 -0700
Saif Khaja wrote:
> 
> Hi everyone,
> I am having a structuring problem with displaying the xml file in the format
> I want.

I think this will do what you want

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

<xsl:template match="History">
  <table>
    <xsl:apply-templates select="des/desRow | asis/asRow">
      <xsl:sort select="name" />
    </xsl:apply-templates>
  </table>
</xsl:template>
	
<xsl:template match="desRow | asRow">
  <xsl:if test="not(name = preceding::name)">
    <tr>
      <td><xsl:value-of select="name" /></td>
      <td>
        <xsl:choose>
          <xsl:when test="name() = 'desRow'"><xsl:value-of
select="qty"/></xsl:when>
          <xsl:otherwise>-</xsl:otherwise>
        </xsl:choose>
      </td>
      <td>
        <xsl:choose>
          <xsl:when test="../../asis/asRow[name = current()/name]/qty">
            <xsl:value-of select="../../asis/asRow[name =
current()/name]/qty"/>
          </xsl:when>
          <xsl:otherwise>-</xsl:otherwise>
        </xsl:choose>
      </td>
    </tr>
  </xsl:if>
</xsl:template>
</xsl:stylesheet>

Gary


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


Current Thread