RE: [xsl] Need advise on filtering XSL

Subject: RE: [xsl] Need advise on filtering XSL
From: Jarno.Elovirta@xxxxxxxxx
Date: Tue, 28 Jan 2003 17:15:16 +0200
Hi,

> Hello all! This is my first post and unfortunately quite a 
> big one as well. I am looking at the following XSL that has 
> been written by someone else and am trying to understand 
> certain parts of it. First and foremost, as you can see in 
> the comments the output method has been set to text so that 
> < and > would be treated properly.

It appears the person who wrote this in the first place didn't know XSLT. Anyhow, the following will do the job

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:xalan="http://xml.apache.org/xalan";
                exclude-result-prefixes="xalan">

<xsl:strip-space elements="DataSet ResultSet ResultSetMetaData DataRow column"/>

<xsl:param name="filterstmt"/>

<xsl:template match="DataSet">
  <xsl:copy>
    <xsl:copy-of select="ResultSetMetaData" />
    <xsl:choose>
      <xsl:when test="'ALL' = $filterstmt">
        <xsl:copy-of select="DataRow" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:copy-of select="DataRow[xalan:evaluate($filterstmt)]" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:copy>
</xsl:template>

</xsl:stylesheet>

Depending on what the value of $filterstmt is, you maybe be able to write the stylesheet without using the xalan:evaluate.

Cheers,

Jarno - Dulce Liquido: Psicosis

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


Current Thread