xsl-list
[Top] [All Lists]

Re: [xsl] build-in template question

2008-09-04 18:25:46
Garvin Riensche wrote, On 2008-09-05 00:17:
Hello,

I have a question concerning text nodes. If I have an xml file like

<root>
  <e>text</e>
</root>

and a template like

<xsl:template match="e">
  <xsl:copy/>
</xsl:template>

than, the output will be "<e>text</e>".

Is the text insterted to the output by xsl:copy or by the build-in template

<xsl:template match="text()|@*">
  <xsl:value-of select="."/>
</xsl:template>
?
During evaluation of applicable templates on a particular node, the most specific template is chosen. If two or more templates is of the same level of specification, then the template with the highest priority is chosen. I have forgotten what happens if two templates cannot be separated (a situaiton that I try to avoid), although a qualified guess is that an XSLT 1.0 processor does something and an XSLT 2.0 processor returns an error message. Anyway, in this case, the match="e" is more specifc than match="text()|@*" so the first template is chosen.

regards,
Garvin


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--
Carpe Diem!
===
Jonas Mellin, Assistant Professor in Computer Science
School of Humanities and Informatics, Building E-2
University of Skövde, P.O. Box 408, SE-541 28 Skövde, Sweden
Phone: +46 500 448321, Fax: +46 500 448399
Email: jonas(_dot_)mellin(_at_)his(_dot_)se, URL: http://www.his.se/melj


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--