[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
At 2012-06-23 15:56 -0400, Nathan Tallman wrote:
Not one whit.
But note that Chris is checking the value of the element, not the value of a child text node. It is never a good idea to use text() for checking an element in a match. You would only address text() in a match when you need to work on the text node content itself (say, for transliterating some characters).
My guess is that you were trying to use text() somewhere in your XPath expression and that messed things up.
I hope this is helpful.
. . . . . . . Ken
Re: [xsl] Xpath Syntax Issue
Subject: Re: [xsl] Xpath Syntax Issue From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Sat, 23 Jun 2012 17:01:42 -0300 |
At 2012-06-23 15:56 -0400, Nathan Tallman wrote:
I've tried this syntax, and tried again, yet the fish persists. Does it make a difference if in my real-world application, it's not fish, but a URL that I'm matching?
Not one whit.
But note that Chris is checking the value of the element, not the value of a child text node. It is never a good idea to use text() for checking an element in a match. You would only address text() in a match when you need to work on the text node content itself (say, for transliterating some characters).
My guess is that you were trying to use text() somewhere in your XPath expression and that messed things up.
I hope this is helpful.
. . . . . . . Ken
On Sat, Jun 23, 2012 at 3:51 PM, Christopher R. Maden <crism@xxxxxxxxx> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 06/23/2012 03:48 PM, Nathan Tallman wrote: >> <xsl:template match="pets/animal/species[text()='fish']"/> > > This template matches the species element, not the animal element. > > Try > > <xsl:template match="pets/animal[species='fish']"/> > > Or better, > > <xsl:template match="pets/animal[normalize-space(species)='fish']"/> > > ~Chris > - -- > Chris Maden, text nerd <URL: http://crism.maden.org/ > > LIVE FREE: vote for Gary Johnson, Libertarian for President. > <URL: http://garyjohnson2012.com/ > <URL: http://lp.org/ > > GnuPG fingerprint: DB08 CF6C 2583 7F55 3BE9 A210 4A51 DBAC 5C5C 3D5E
-- 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] Xpath Syntax Issue, Nathan Tallman | Thread | Re: [xsl] Xpath Syntax Issue, John A. Walsh |
Re: [xsl] Xpath Syntax Issue, Nathan Tallman | Date | Re: [xsl] Xpath Syntax Issue, John A. Walsh |
Month |