xsl-list
[Top] [All Lists]

Re: [xsl] process xslt and xml spreadsheet via web browser

2014-09-12 07:14:06
On Fri, September 12, 2014 12:53 pm, rl(_at_)openmailbox(_dot_)org wrote:
...
<?xml version="1.0"?>
<xsl:stylesheet
      version="2.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
      xmlns='http://www.w3.org/1999/xhtml'>
      <xsl:output
              method="text"
              encoding="utf-8"
              indent="no"
              omit-xml-declaration="yes"
              media-type="text/plain"
              standalone="yes"
              />
      <xsl:template match='Cells'>
              <xsl:apply-templates select='Cell'/>
      </xsl:template>
</xsl:stylesheet>

The Jedit text editor was used with the plugin XLST processor (uses
Xalan Java), which produces the text file (below). Why does the text
file contain text from nodes outside the nodes 'Cells' and 'Cell'?

Because of the built-in template rules.  See
http://www.w3.org/TR/xslt20/#built-in-rule

The default for the document node and for element nodes is to process
their children, and the default for text nodes is to return a text node
with the string value of the node, so in the absence of any rules to the
contrary, you get the string value of all the text nodes in the document.

If you add another template rule matching on "/" that selects just its
descendant 'Cells', then you'll bypass the default processing of all the
rest of the nodes under the document node.

Regards,


Tony Graham                                         
tgraham(_at_)mentea(_dot_)net
Consultant                                       http://www.mentea.net
Chair, Print and Page Layout Community Group @ W3C    XML Guild member
  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
Mentea       XML, XSL-FO and XSLT consulting, training and programming
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>