Subject: RE: [xsl] Constructing Simple Content and Built-in Template Rules From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Wed, 13 Apr 2005 09:40:28 +0100 |
> Given to following XML, > > <root> > <a>a</a> > <b>b</b> > </root> > > a stylesheet with only one root template with the instruction > <xsl:apply-templates select="root"/> does the same as a > stylesheet with the > instruction <xsl:value-of select="root"/>, namely: "ab" > (neglecting possible whitespaces). > > Is this always correct? The effect is the same, but by coincidence rather than by definition. I think the effect will always be the same if the content is untyped. In 2.0 in the presence of a schema, however, doing the recursive descent with apply-templates will give you the concatenation of the text nodes, whereas value-of takes the typed value and converts it to a string, which may be subtly different. In the worst case, if <root> is described in the schema as an element with element-only content, value-of will fail, because such an element has no typed value. Michael Kay http://www.saxonica.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Constructing Simple Content a, Peter Gerstbach | Thread | Re: [xsl] Constructing Simple Conte, David Carlisle |
[xsl] Constructing Simple Content a, Peter Gerstbach | Date | RE: [xsl] XSLT 2.0 Grouping in XSLT, Michael Kay |
Month |