I wanted to use XalanTransformer::setStylesheetParam in an application, but I 
wanted to test out how it worked (i.e. how to indicate the param in the 
stylesheet itself). I have this xml (param.xml)

<?xml version="1.0"?>
<books>
                                <title>Foo</title>
                                <title>Bar</title>
                                <title>Baz</title>
</books>

Being used with this stylesheet (param.xsl)

<xsl:stylesheet version = '1.0'
        xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
        <xsl:output method="text"/> 

        <xsl:param name="TITLE"/>

        <xsl:template match="/">
                <xsl:text>
Testing title for the value(</xsl:text><xsl:value-of 
select="$TITLE"/><xsl:text>)

</xsl:text>
                <xsl:apply-templates select="//title"/>
        </xsl:template>

        <xsl:template match="title">
<xsl:text>Testing the title:  </xsl:text><xsl:value-of 
select="text()"/><xsl:text>
</xsl:text>
                <xsl:if test="$TITLE = text()"><xsl:text>
Found the title you wanted!
</xsl:text>
                </xsl:if>
        </xsl:template>
</xsl:stylesheet>

Using this command-line: Xalan -p TITLE Bar -o param.out param.xml param.out

param.out looks like this:

Testing title for the value()

Testing the title:  Foo
Testing the title:  Bar
Testing the title:  Baz

I would expect that the value in the parenthesis to be Bar and to get a match 
from the $TITLE = text() line, but I don't.

Am I just completely misunderstanding how this works? I couldn't find a bug in 
bugzilla for this, so I'm guessing it's user error here, not Xalan. This 
example is similar to an example given in an XSLT faq at: 
<http://www.dpawson.co.uk/xsl/sect2/N5982.html#d5626e85>

Thanks,
Rachael
************************************************
No employee or agent is authorized to conclude any binding agreement on behalf 
of MGB Ltd. with another party by email without express written confirmation by 
MGB Ltd. officers.

Reply via email to