Subject: [xsl] Re: Matching the first text element in a subtree From: Martin Holmes <mholmes@xxxxxxx> Date: Wed, 19 Apr 2006 16:13:26 -0700 |
oXygen complains that "Axis in pattern must be child or attribute",
meaning presumably that only element nodes, not text nodes, can be selected using this axis.
can't use
No, it means what it says. You can use "//" in a pattern, but you
the descendant axis, or any axis other than "child" or "attribute".It's an
irritating restriction when you hit it, but it doesn't come upsufficiently
often to have been fixed in 2.0.
which is a descendant of the p tag?Can anyone suggest how to go about selecting the first text node
In 2.0:
p//text()[. is ancestor::p[1]/descendant::text()[1]]
In 1.0:
p//text()[generate-id(.) = generate-id(ancestor::p[1]/descendant::text()[1])]
That works great -- it's exactly what I need. The whitespace issue isn't a problem -- I stupidly pretty-printed my example without thinking, trying to clarify the structure, but the original documents are clean.
Cheers, Martin
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Matching the first text e, Michael Kay | Thread | [xsl] Re: Matching the first text e, Martin Holmes |
Re: [xsl] Aargh - wrong template ap, Wendell Piez | Date | [xsl] Re: Matching the first text e, Martin Holmes |
Month |