[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

dynamically change xpath expression with params


Subject: dynamically change xpath expression with params
From: Lonny_Angell@xxxxxxx
Date: Wed, 1 Nov 2000 18:22:50 -0400 (EST)


Is this possible?

I need to change both the values in an XPath Expression at runtime. I would like
to do it with Params (something I can pass in to the XSL sheet). Then I could
pass the new values to the Params from the browser or from a Servlet. Here is a
XSL fragment that shows what I'm trying to accomplish. Any Ideas???

Thanks,

Lonny Angell

<xsl:template match="LogEvents">

<!-- XSL PARAMETERS -->
<xsl:param name="filter" select="string('INFO')"/>
<xsl:param name="selColumn" select="//LogEvents/LogEvent/Type"/>

<xsl:for-each select="LogEvent [  $selColumn=$filter]">
       <xsl:sort select="DATE" order="ascending"/>
       <tr>
      <td class= "tData"><xsl:value-of select="Date"/></td>
      <td class= "tData"></td>
      <td class= "tData"><xsl:value-of select="Time"/></td>
      <td class= "tData"></td>
            <td class= "tData"><xsl:value-of select="Type"/></td>
      <td class= "tData"></td>
    </tr>
    <tr>
      <td class= "tData" colspan="11">  <hr></hr></td>
    </tr>
  </xsl:for-each>
.....
<xsl:template/>

FOR THIS XML BELOW --
             |
             |

<LogEvents Created="Mon Oct 30 13:45:10 CST 2000">
  <APPLICATION>Test Application #2</APPLICATION>
  <LogEvent>
    <User>root</User>
    <Type>WARNING</Type>
    <Time>01:45:10 PM</Time>
    <Text>This is a Test Message of the type Warning</Text>
    <Source>log.ejb.LogServerBean@9a8fdf7e</Source>
    <Host>Unknown</Host>
    <Date>2000/10/30</Date>
  </LogEvent>
  <LogEvent>
    <User>root</User>
    <Type>INFO</Type>
    <Time>01:45:43 PM</Time>
    <Text>This is a Test Message of the type INFO</Text>
    <Source>log.ejb.LogServerBean@9a8fdf7e</Source>
    <Host>Unknown</Host>
    <Date>2000/10/30</Date>
  </LogEvent>

.........
</LogEvents>





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



Current Thread
Keywords