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

Is it possible to test a macro argument?

Subject: Is it possible to test a macro argument?
From: "Oren Ben-Kiki" <oren@xxxxxxxxxxxxx>
Date: Tue, 29 Dec 1998 18:43:13 +0200
argument test
I've tried to do:

<xsl:macro name="MyMacro>
    <xsl:macro-arg name="MyArg"/>
    <xsl:choose>
        <xsl:when test="arg(MyArg)=1">
            <xsl:text>First</xsl:text>
        </xsl:when>
        <xsl:when test="arg(MyArg)=2">
            <xsl:text>Second</xsl:text>
        </xsl:when>
    </xsl:choose>
</xsl:macro>

But XT (the latest) has sternly refused to accept it. From reading the
latest draft, it seems that the 'test' attribute of <xsl:when> is a select
pattern, only the 'select' attribute of <xsl:value-of> is a string
expression.

There's an editorial note indicating the name 'test' isn't final, and that
maybe it should be a match pattern instead of a select pattern. I feel that
a match pattern isn't enough - testing macro arguments is really something
which should be possible. Constants, too. Maybe we need to define a separate
test expression?

I also find it strange that 'expr' was changed to 'select'. It would have
been nice if each 'select' was a select pattern, each 'match' was a match
pattern, each 'test' was a test expression, and each 'expr' was a string
expression... I suppose there was a good reason for this rename - could
someone post it?

Another question: for each template processing mode, there's an implicit:

<xsl:template match="*|/" mode="the-mode">
<xsl:apply-templates/>
</xsl:template>

Shouldn't it be:

<xsl:template match="*|/" mode="the-mode">
<xsl:apply-templates mode="the-mode"/>
</xsl:template>

Instead? It easy enough to work around, but strange. Is this intentional?

Share & Enjoy,

    Oren Ben-Kiki


 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.