Subject: RE: [xsl] newbie - parameters with/without values?? From: "Ragulf Pickaxe" <jawxml@xxxxxxxxxxx> Date: Tue, 05 Oct 2004 09:37:30 +0000 |
Regards, Ragulf Pickaxe :-)
From: "Hardy Merrill" <HMerrill@xxxxxxxxxxxxxxxx> Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>,<mike@xxxxxxxxxxxx> Subject: RE: [xsl] newbie - parameters with/without values?? Date: Mon, 04 Oct 2004 13:01:00 -0400
I'm trying to understand...
Given the XML document below with 2 "person" nodes in it, if my XSL document looks like this: --------------------------------------------- <?xml version='1.0'?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" />
<xsl:param name="gender"/> <xsl:param name="city"/>
<xsl:template match="/my_document"> <xsl:for-each select="person[$gender = '' or gender = '$gender']"> <p>Name: <xsl:value-of select="name"/></p> </xsl:for-each> </xsl:template> </xsl:stylesheet> --------------------------------------------- 1. if the value of parameter "gender" is the "default default" (""), then what if anything will be displayed?
2. if parameter "gender" has a value of "Male", will "Name: Joe" be the output?
I read in your (Michael's) book about the "or" only evaluating the 2nd operand if the 1st operand is false. But I still don't quite understand how the xpath select will be evaluated if the parameter has a "" value - the first operand ($gender='') will then be true, which will essentially make the xpath select="person[$gender='']" right? And I don't know how xpath will interpret that.
Please straighten me out ;-)
TIA.
Hardy Merrill
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] newbie - parameters with/, Hardy Merrill | Thread | [xsl] Markup for magazines, 0 8 |
[xsl] copy vs. copy-of performance , Werner, Wolfgang | Date | Re: [xsl] Re: [xslt transform & gro, Michael PG |
Month |