[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Is it possible to test a macro argument?
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|