[Bug 1289] New: String variables in the stylesheet


           Summary: String variables in the stylesheet
           Product: XPath / XQuery / XSLT
           Version: Last Call drafts
          Platform: PC
        OS/Version: Windows 2000
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQueryX
        AssignedTo: jim.melton@acm.org
        ReportedBy: davidc@nag.co.uk
         QAContact: public-qt-comments@w3.org

The stylesheet has lots of variables initialised using the (equivalent) forms
  <xsl:variable name="DOT">.</xsl:variable>
  <xsl:variable name="SLASH"><xsl:text>/</xsl:text></xsl:variable>

It's something of a FAQ over on xsl-list that this is rather inefficient
as it makes a result tree fragment (or document node in XSLT2) that is more
expensive than a string to build, and has to be repeadedly coerced to a string
when used. Efficiency isn't really the main concern here, but as a stylesheet
appearing in a rec-track document it might be used as an example code
and also, as the only normative definition of xqueryx it may be reasonably
expected to be used in running XqueryX implementations as a first pass
converting XqueryX input to Xquery. If the stylesheet were converted to XSLT2
this would become more of a problem, as XSLT2 is rather less inclined to
automatically coerce between different types.

  <xsl:variable name="DOT" select="'.'"/>
  <xsl:variable name="SLASH" select="'/'"/>

would declare these things as strings.

There are also one or two variables that are "dead code" for constructs that are
no longer used. For similar reasons these ought to be dropped, eg

  <xsl:variable name="CDATA_BEGIN">


Received on Tuesday, 3 May 2005 11:18:25 UTC