cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yann" <>
Subject XSL variable name usage
Date Wed, 26 Apr 2000 14:54:02 GMT
Sorry if this is not that Cocoon related, but I am stuck and I have tight
deadlines to demonstrate my Coccon project.

In my XSL document, I want to compare the value of a temporary XSL variable
with an element attribute from my XML document (an item element) so that I
can decide which item to be the selected value in a combobox:

<xsl:template match="Combobox">
  <select name="combovalue" >
   <xsl:variable name="selecteditem" select="@selected" />
   <xsl:apply-templates />

<xsl:template match="Item">
  <xsl:element name="option">
   <xsl:if test="itemcode=$selecteditem">
    <xsl:attribute name="selected">true</xsl:attribute>
   <xsl:attribute name="value"><xsl:value-of select="itemcode"
   <xsl:value-of select="itemstring" />

I get:

org.apache.xalan.xslt.XSLProcessorException: pattern =
VariableReference given for variable out of context or without definition!
Name = selecteditem

It's not very difficult what I want to do (have a temporary variable to use
in another template). I imagined it would be visible from children nodes

Thanks for your help,

Yann, nearly finishing his first Cocoon-based web-app.

View raw message