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

Re: [xsl] Can I diplay the used by xsl:if test=""?


Subject: Re: [xsl] Can I diplay the <expression> used by xsl:if test="<expression>"?
From: René de Vries <RdVries@xxxxxxxxxxx>
Date: Thu, 1 Aug 2002 17:09:45 +0200

Hi David,

I want to display the LITERAL text of the test.
So if it would be <xsl:if test="aNode &gt; 0"/> I want to display "aNode
&gt; 0".
Reason is that I want to pass the expression to a template to have it tested
and want to display in the template WHAT I've tested.

Something like this:
<xsl:call-template name="TestTheExpression">
    <xsl:with-param name="TheExpression" select="'aNode &gt; 0'"/>
</xsl:call-template>

<xsl:template name="TestTheExpression">
    <xsl:param name="TheExpression"/>

    <xsl:if test="$TheExpression"> // this won't work, because TheExpression
is now a literal and will evaluate to true....
        ... do something ..
        <xsl:value-of select="$TheExpression"/>
    </xsl:if>
</xsl:template>

Greetings René
   {@   @}
        ^
      \_/

"You don't need eyes to see, you need vision!"
----- Original Message -----
From: "David Carlisle" <davidc@xxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Thursday, August 01, 2002 12:27 PM
Subject: Re: [xsl] Can I diplay the <expression> used by xsl:if
test="<expression>"?


> I want to do this:
> <xsl:if test="test something">
>    <xsl:text>Error because: </xsl:test>
>    <xsl:value-of select="......"/>   // what do I put on the dots to get
>"test something"????
>    <xsl:text> was true.</xsl:test>
></xsl:if>

don't use xsl:value-of just use
<xsl:text>test something</xsl:text>

Or use xsl:value of and use '...' so it's a string.

David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

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



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



Current Thread