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

Re: Storing xpath expressions in a vaiable

Subject: Re: Storing xpath expressions in a vaiable
From: Sridhar_Ramachandran@xxxxxx
Date: Thu, 28 Sep 2000 22:01:31 -0700
xpath xmlns java
Paul and Evan,

Thanks for both your responses. I was able to get what I wanted by using
<xsl:include> and <xsl:call-template>. I created filter_notes.xsl which
contained a bunch of xsl:when under an xsl:choose. Each of these xsl:when
set the value of a parameter to a node-set derived from the appropriate
xpath expression and then called a handle_notes template. The
filter_notes.xsl contains all the xsl within a named template and this
template is explicitly called by the .xsl which includes the
filter_notes.xsl. This way I could get control of when the filtering etc.
actuly happens. Below is the listing for the including xsl, would like some
comments on this approach.
thanks

Sridhar

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0"
                xmlns:java="http://xml.apache.org/xslt/java"
                exclude-result-prefixes="java">
<xsl:import href="filter_table_notes.xsl"/>
<xsl:output method="html" indent = "yes"/>

<xsl:param name="filter_release" />
<xsl:param name="filter_template"/>
<xsl:param name="filter_product"/>
<xsl:param name="filter_solution" />

<xsl:variable name="relFilterFileName" select="string
('releasefilter.dat')"/>
<xsl:variable name="dummy" select="java:XmlUtil.loadReleaseFilterMap
($relFilterFileName)"/>

<xsl:template match="/">
    <HTML>
    <BODY>
    <HR SIZE="10" NOSHADE="TRUE"/>
        <xsl:apply-templates select="TABLE"/>
    </BODY>
    </HTML>
</xsl:template>

<xsl:template match="TABLE">
    <H1 STYLE="font-weight:bold; font-size:24; color:blue;
text-align:center"><xsl:value-of select="@NAME"/></H1>
    <B><I>DESCRIPTION:</I></B><P><xsl:value-of select="./DESCRIPTION"/>
</P>

    <TABLE BORDER="1" FRAME="BOX" BGCOLOR="#FFF9C">
    <CAPTION ALIGN="top">Table Level Notes</CAPTION>
    <th> Author </th>
    <th> Template </th>
    <th> Product</th>
    <th> Solution </th>
    <th> Date </th>
    <th> Comments   </th>

    <xsl:call-template name="filter_table_notes"/>

    </TABLE>
</xsl:template>

<xsl:template name="handle-table-notes">
      <xsl:param name="notes_list"/>
      <xsl:for-each select="$notes_list">
          <tr>
          <td> <xsl:value-of select="@AUTHOR"/></td>
          <td> <xsl:value-of select="@TEMPLATE"/></td>
          <td> <xsl:value-of select="@PRODUCT"/></td>
          <td> <xsl:value-of select="@SOLUTION"/></td>
          <td> <xsl:value-of select="@DATE"/></td>
          <td> <xsl:value-of select = "."/></td>
          </tr>
      </xsl:for-each>
</xsl:template>


</xsl:stylesheet>

Here is a excerpt from  filter_table_notes

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0"
                xmlns:java="http://xml.apache.org/xslt/java"
                exclude-result-prefixes="java">
<xsl:template name="filter_table_notes">
    <xsl:choose>
        <xsl:when test="$filter_template and $filter_product and
$filter_solution ">
            <xsl:call-template name="handle-table-notes">
                <xsl:with-param name = "notes_list"
                                select= "//TABLE/NOTES[@TEMPLATE
=$filter_template and @PRODUCT=$filter_product and @SOLUTION
= $filter_solution]"/>
            </xsl:call-template>
        </xsl:when>


 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.