|
[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: top level xsl:param confusion
Subject: Re: top level xsl:param confusion
From: Robert Koberg <rob@xxxxxxxxxx>
Date: Thu, 30 Sep 2004 15:13:04 -0700
|
Werner, Wolfgang wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Robert,
I think the part of the spec you're looking for is here:
http://www.w3.org/TR/xpath#function-boolean
You pass in an empty Sting that is converted to a boolean using the
boolean() function in xsl:when/@test.
As described in the spec referenced above, boolean("") returns false
(<quote>a string is true if and only if its length is non-zero</>)
Ahh.. thanks. I was looking in the wrong spec (Jaxp and XSLT 1.0).
So it says:
"a string is true if and only if its length is non-zero"
This does seem right to me, but there it is.
thanks,
-Rob
hth,
Wolfgang
Robert Koberg wrote:
| Hi,
|
|
| I have a top level param like so:
|
| <xsl:param name="permission" select="false()"/>
|
|
| Main Question:
|
| Is the above top level xsl:param considered false even if it was passed
| an empty string? I would expect it to be false only if the param was
| *not* passed.
|
|
| More info:
|
| I send the param down to the transformation if a user has access to the
| filesystem otherwise it is not sent. And if they have access I send the
| path that they are restricted to as the value. Some example values are:
|
| "" -- full project access
| "foo" -- access restricted to the 'foo' folder
| "foo/bar" -- access restricted to the 'foo/bar' folder
|
| If they have no restriction I want the param value to be 'false()'
|
| The problem (or my misunderstanding) is when I pass down the empty
| string value - "". So the transformation sees there is a
| /xsl:stylesheet/xsl:param[@name='permission'] - so it should not
| evaluate to false(), right? However, it does in both Xalan and Saxon
| (the only two I tried). I don't see anything in the spec that addresses
| this.
|
| For example, the following chooses the otherwise when the param is sent
| to the transformation as an empty string.
|
| <xsl:choose>
| <!--<xsl:when test="boolean($permission)"> or -->
| <xsl:when test="$permission">
| <!-- allow access -->
| </xsl:when>
| <xsl:otherwise>
| <!-- no access -->
| </xsl:otherwise>
| </xsl:choose>
|
| thanks for any clarification,
| -Rob
|
|
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Cygwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFBXHhJqjaicDyx8o8RAgH4AJ4whqm3m54XWs5ofyS0ke+2AN8L4gCeJGOg
PbkVtjvtxTpeNltKCrg5xrs=
=n8Ol
-----END PGP SIGNATURE-----

| Current Thread |
Werner, Wolfgang - 30 Sep 2004 22:06:26 -0000
- Robert Koberg - 30 Sep 2004 22:19:04 -0000 <=
xptm - 30 Sep 2004 22:09:23 -0000
david_n_bertoni - 30 Sep 2004 22:10:58 -0000
|
|
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
| RSS 2.0 |
|
| Atom 0.3 |
|
|