Subject: RE: <xsl:template><xsl:value-of/></xsl:template>
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 11 Jan 1999 12:53:10 -0500
|
At 99/01/11 09:35 +0000, Paul Spencer wrote:
>I thought it was some sort of magic incantation to the IE5
>...
>If there is another reason, I, too, would love to know it
>...
>Paul Spencer
>
>-----Original Message-----
>From: owner-xsl-list@xxxxxxxxxxxxxxxx
>[mailto:owner-xsl-list@xxxxxxxxxxxxxxxx]On Behalf Of Kaiman, Charlie
>Sent: 08 January 1999 19:20
>To: 'XSL Listserv'
>Subject: <xsl:template><xsl:value-of/></xsl:template>
>
>
>Can someone tell me what this line does in an XSL style sheet?
>
>"<xsl:template><xsl:value-of/></xsl:template>"
>From XSL Section 2.7.13, <xsl:value-of> extracts text from the source tree.
The entire text data content of the node (in parse order) is the text from
the source tree.
To illustrate this, I've written a stylesheet for both XT and IE5b2, and
the results are noted below.
Interestingly, MSXSL accepts no specification of a match attribute and
appears to match on everything when no value is specified, yet Appendix A
of the WD requires the attribute:
<!ELEMENT xsl:template %template;>
<!ATTLIST xsl:template
match %pattern; #REQUIRED
priority %priority; #IMPLIED
mode NMTOKEN #IMPLIED
%space-att;
>
Looking at the XT and IE5b2 results, I see that both are correctly
interpreting that the value-of is calculated from of *all* of the
subelements of the node, not triggering template rules on subelements (see
element <testb>).
Also note that with no match attribute IE5b2 will process *all* nodes (the
output shows the processing of the XML Declaration), while with the
match="*" attribute the WD Production [12] is documented that "*"
represents elements, so therefore the IE5b2 no-attribute interpretation
can't be documented as "*".
I hope this helps.
............ Ken
T:\FTEMP>type test.xml
<?xml version='1.0'?>
<test>
<testa>Value for a</testa>
<testb>Value for b
<testb1>Value for b1</testb1>
<testb2>Value for b2</testb2>
</testb>
<testc>Value for c</testc>
</test>
T:\FTEMP>rem W3C Stylesheet:
T:\FTEMP>type test.xsl
<?xml version='1.0'?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/TR/WD-xsl"
xmlns="http://www.w3.org/TR/REC-html40"
result-ns="">
<xsl:template match="*">[[<xsl:value-of select="name(.)"/>[<xsl:value-of
select="."/>]]]</xsl:template>
<xsl:template match="/test"><xsl:apply-templates/></xsl:template>
</xsl:stylesheet>
T:\FTEMP>call xsl test.xml test.xsl test.htm
T:\FTEMP>rem W3C Results:
T:\FTEMP>type test.htm
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
[[testa[Value for a]]]
[[testb[Value for b
Value for b1
Value for b2
]]]
[[testc[Value for c]]]
T:\FTEMP>rem IE5b2 Stylesheet:
T:\FTEMP>type test.msxsl
<?xml version='1.0'?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/TR/WD-xsl"
xmlns="http://www.w3.org/TR/REC-html40"
result-ns="">
<xsl:template>[[<xsl:nodeName/>[<xsl:value-of/>]]]</xsl:template>
<xsl:template match="/"><xsl:apply-templates/></xsl:template>
<xsl:template match="/test"><xsl:apply-templates/></xsl:template>
</xsl:stylesheet>
T:\FTEMP>call msxsl test.xml test.msxsl test.mshtm
T:\FTEMP>rem IE5b2 Results:
T:\FTEMP>type test.mshtm
[[xml[]]][[testa[Value for a]]][[testb[Value for b Value for b1Value for
b2]]][[testc[Value for c]]]
T:\FTEMP>
--
G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Training: http://www.CraneSoftwrights.com/s/schedule.htm
Resources: http://www.CraneSoftwrights.com/s/resources.htm
Shareware: http://www.CraneSoftwrights.com/s/shareware.htm
Next XSL Training (see training link): WWW8 - 1999-05-11
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|