[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
At 2012-05-13 23:17 +0200, Jorge wrote:
I see now that saxon was doing it by default. When I add -strip:none to the invocation then your code fails.
But the normalize-space() returns a string, so how you address the content is irrelevant. It isn't that you were addressing a text node that a text node was returned, it was that your function was returning a tree with a text node created from the string output from normalize-space(). Your code was expecting the string to be returned. It is very subtle and it comes up in class.
If you have the time I have posted 5 free hours of my XSLT training video here:
http://www.CraneSoftwrights.com/links/udemy.htm
... where you do not need to create a username in order to view free content ... just close the sign-up dialogue box. The free stuff is mostly introductory, so this particular issue is not covered, but you might find other tips.
No apology necessary ... I'm just trying to keep things found in the archive from pointing readers the "wrong" way.
Good luck in your project!
. . . . . . . . . . Ken
Re: [xsl] xsl:if test = empty string, returns true
Subject: Re: [xsl] xsl:if test = empty string, returns true From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Sun, 13 May 2012 17:32:43 -0400 |
At 2012-05-13 23:17 +0200, Jorge wrote:
> And, you are looking for the adjacent node (which in your example is a text node), rather than the adjacent element (unless you are invoking saxon with the option to strip white-space text nodes from your input, in which case that is not true).
No I wasn't invoking saxon with such option, but did try nevertheless to use:
<xsl:strip-space elements="plist dict"/>
and
<xsl:strip-space elements="*"/>
Still, even with or without those, if I assigned a value to the string, the function did capture it and showed it in the output of my original stylesheet in either case. Why does following::node()[1] return the string's value in both cases then?
I see now that saxon was doing it by default. When I add -strip:none to the invocation then your code fails.
> BTW, I very rarely ever have to address text() nodes
Well, I did that to try to force the function to return a string instead of a tree :-/
But the normalize-space() returns a string, so how you address the content is irrelevant. It isn't that you were addressing a text node that a text node was returned, it was that your function was returning a tree with a text node created from the string output from normalize-space(). Your code was expecting the string to be returned. It is very subtle and it comes up in class.
As you can see there are still concepts of XSL that I am not quite grasping yet.
If you have the time I have posted 5 free hours of my XSLT training video here:
http://www.CraneSoftwrights.com/links/udemy.htm
... where you do not need to create a username in order to view free content ... just close the sign-up dialogue box. The free stuff is mostly introductory, so this particular issue is not covered, but you might find other tips.
More than appreciated. I simply wanted to discourage answers that focused on issues that did not address my main question. Please excuse me for the prejudice.
No apology necessary ... I'm just trying to keep things found in the archive from pointing readers the "wrong" way.
Good luck in your project!
. . . . . . . . . . Ken
-- Public XSLT, XSL-FO, UBL and code list classes in Europe -- Oct 2012 Contact us for world-wide XML consulting and instructor-led training Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Google+ profile: https://plus.google.com/116832879756988317389/about Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xsl:if test = empty strin, Jorge | Thread | Re: [xsl] xsl:if test = empty strin, Michael Kay |
Re: [xsl] xsl:if test = empty strin, Jorge | Date | Re: [xsl] xsl:if test = empty strin, Michael Kay |
Month |