Extension for controlling output indenting

"John L. Clark" <[email protected]>
Newsgroups gmane.text.xml.xslt.extensions
Message-ID <20060228081232.GG10347@rejoice>
The next thing in my queue for the Resources module has been
functionality allowing users to "turn off" indenting for particular
sections of the output tree.  For this, we've decided to go with an
attribute on the <xsl:output/> element called res:no-indent-elements.
I've come up with an initial specification.  This specification depends
on the existence of a generic "res:xml" output mode that allows for
extension.  I've written a brief spec that allows for this output mode,
as well.  The sources and HTML views for the first drafts of these
should be attached.

Take care,

    John L. Clark

_______________________________________________
exslt mailing list
[email protected]
http://www.exslt.org/list
res.xml.xml (text/plain, 1.9 KB)
<?xml version="1.0"?>
<exslt:value-set xmlns:exslt="http://exslt.org/documentation" 
                 version="1" module="res" status="new">

<exslt:name>xml</exslt:name>

<rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                 xmlns:dc="http://purl.org/dc/elements/1.1/"
                 ID="res:xml">
  <dc:subject>EXSLT</dc:subject>
  <dc:subject>res</dc:subject>
  <dc:subject>xml</dc:subject>
  <dc:rights>public domain</dc:rights>
  <exslt:revision>
    <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                     xmlns:dc="http://purl.org/dc/elements/1.1/"
                     ID="res:xml.1">
      <exslt:version>1</exslt:version>
      <dc:creator email="[email protected]" 
                 url="http://infinitesque.net/">John L. Clark</dc:creator>
      <dc:date>2006-02-27</dc:date>
      <dc:description>Extensible version of the built-in "xml" output mode.</dc:description>
    </rdf:Description>
  </exslt:revision>
</rdf:Description>

<exslt:doc xmlns="http://www.w3.org/1999/xhtml">
  <p>For the purposes of this description, consider the <code>xsl</code>
  namespace prefix to be bound to the
  <code>http://www.w3.org/1999/XSL/Transform</code> namespace URI.  This
  specification defines a new output method on the <code>xsl:output</code>
  element named <code>res:xml</code>.  The core behavior of this output
  method is identical to that of the built-in <a
  href="http://www.w3.org/TR/xslt#section-XML-Output-Method"><code>xml</code>
  output mode</a>.  This behavior, however, can be modified by other
  attributes that are also both in the
  <code>http://exslt.org/resource</code> namespace and present on the
  <code>xsl:output</code> element.</p>
</exslt:doc>

<exslt:definition xmlns="http://www.w3.org/1999/xhtml"
  >&lt;xsl:output method="<em>res:xml</em>"/&gt;</exslt:definition>

</exslt:value-set>
index.html (text/html, 2.9 KB)
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "/schema/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>EXSLT - res:xml</title><link href="http://exslt.org/base.css" rel="stylesheet"/></head><body><h1 id="#title"><a href="http://www.exslt.org/">EXSLT</a> - <a href="http://www.exslt.org/res">res</a>:<a href="http://www.exslt.org/res/value-sets/xml">xml</a></h1><table><tr><td id="menu"><p class="level1"><a href="res.xml.html">Implementer Page</a></p><p class="level1"><a href="../../../howto.html">How To</a></p><p class="level1"><a href="../../../download.html">Downloads</a></p><p class="level1">Modules</p><p class="level2"><a href="../../../date/index.html">Dates and Times</a></p><p class="level2"><a href="../../../dyn/index.html">Dynamic</a></p><p class="level2"><a href="../../../exsl/index.html">Common</a></p><p class="level2"><a href="../../../func/index.html">Functions</a></p><p class="level2"><a href="../../../math/index.html">Math</a></p><p class="level2"><a href="../../../random/index.html">Random</a></p><p class="level2"><a href="../../../regexp/index.html">Regular Expressions</a></p><p class="level2"><a href="../../../res/index.html">Resource</a></p><p class="level3"><a href="../../functions/document/index.html">res:document()</a></p><p class="level3"><a href="../../value-sets/xml/index.html">&#8220;res:xml&#8221;</a></p><p class="level2"><a href="../../../set/index.html">Sets</a></p><p class="level2"><a href="../../../str/index.html">Strings</a></p><p class="level2"><a href="../../../sys/index.html">System</a></p><p class="level1"><a href="../../../submissions/">Submissions</a></p><p class="level1"><a href="../../../list">Mailing List</a></p><p class="level1"><a href="../../../contact.html">Contact</a></p></td><td id="content"><p><b>Implementer Page: </b><a href="res.xml.html">res.xml.html</a><br/><b>Value-set Package: </b><a href="res.xml.zip">res.xml.zip</a></p><h4>Value-set Syntax</h4><pre>&lt;xsl:output method="<em>res:xml</em>"/&gt;</pre><p>For the purposes of this description, consider the <code>xsl</code>
  namespace prefix to be bound to the
  <code>http://www.w3.org/1999/XSL/Transform</code> namespace URI.  This
  specification defines a new output method on the <code>xsl:output</code>
  element named <code>res:xml</code>.  The core behavior of this output
  method is identical to that of the built-in <a href="http://www.w3.org/TR/xslt#section-XML-Output-Method"><code>xml</code>
  output mode</a>.  This behavior, however, can be modified by other
  attributes that are also both in the
  <code>http://exslt.org/resource</code> namespace and present on the
  <code>xsl:output</code> element.</p></td></tr></table><div id="colophon"><p><a href="http://www.exslt.org/res/value-sets/xml/index.html">http://www.exslt.org/res/value-sets/xml/index.html</a> last modified 2006-02-27</p></div></body></html>
res.no-indent-elements.xml (text/plain, 2.6 KB)
<?xml version="1.0"?>
<exslt:attribute xmlns:exslt="http://exslt.org/documentation" 
                 version="1" module="res" status="new">

<exslt:name>no-indent-elements</exslt:name>

<rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                 xmlns:dc="http://purl.org/dc/elements/1.1/"
                 ID="res:no-indent-elements">
  <dc:subject>EXSLT</dc:subject>
  <dc:subject>res</dc:subject>
  <dc:subject>no-indent-elements</dc:subject>
  <dc:rights>public domain</dc:rights>
  <exslt:revision>
    <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                     xmlns:dc="http://purl.org/dc/elements/1.1/"
                     ID="res:no-indent-elements.1">
      <exslt:version>1</exslt:version>
      <dc:creator email="[email protected]" 
                 url="http://infinitesque.net/">John L. Clark</dc:creator>
      <dc:date>2006-02-27</dc:date>
      <dc:description>Initial draft</dc:description>
    </rdf:Description>
  </exslt:revision>
</rdf:Description>

<exslt:doc xmlns="http://www.w3.org/1999/xhtml">
  <p>When using the <code>xml</code> output method and
  <code>indent="yes"</code>, an XSLT processor can add whitespace to the
  serialized output tree in order to format it nicely.  The
  <code>res:no-indent-elements</code> attribute selectively disables this
  indenting behavior, to protect branches of the tree that would be
  sensitive to adding additional whitespace.</p>

  <p>For the purposes of this description, consider the <code>xsl</code>
  namespace prefix to be bound to the
  <code>http://www.w3.org/1999/XSL/Transform</code> namespace URI.  When the
  <code>xsl:output</code> element uses the <code>res:xml</code> method and
  <code>indent="yes"</code>, then the <code>res:no-indent-elements</code>
  attribute should be interpreted as a whitespace-separated list of <a
  href="http://www.w3.org/TR/xpath#NT-NameTest">NameTest</a>s.  The
  processor method may output whitespace in the same fashion as <a
  href="http://www.w3.org/TR/xslt#section-XML-Output-Method">the built-in
  <code>xml</code> method</a> unless the output values are descendants of
  an element matching one of the NameTests in the
  <code>res:no-indent-elements</code> attribute, in which case the processor
  must not output extra whitespace.  If the <code>xsl:output</code> element
  does not use both the <code>res:xml</code> method and
  <code>indent="yes"</code>, then this attribute has no effect.</p>
</exslt:doc>

<exslt:definition xmlns="http://www.w3.org/1999/xhtml"
  >&lt;xsl:output method="res:xml" indent="yes"
            <em>res:no-indent-elements="[tokens]"</em>/&gt;</exslt:definition>

</exslt:attribute>
index.html (text/html, 3.9 KB)
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "/schema/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>EXSLT - res:no-indent-elements</title><link href="http://exslt.org/base.css" rel="stylesheet"/></head><body><h1 id="#title"><a href="http://www.exslt.org/">EXSLT</a> - <a href="http://www.exslt.org/res">res</a>:<a href="http://www.exslt.org/res/attributes/no-indent-elements">no-indent-elements</a></h1><table><tr><td id="menu"><p class="level1"><a href="res.no-indent-elements.html">Implementer Page</a></p><p class="level1"><a href="../../../howto.html">How To</a></p><p class="level1"><a href="../../../download.html">Downloads</a></p><p class="level1">Modules</p><p class="level2"><a href="../../../date/index.html">Dates and Times</a></p><p class="level2"><a href="../../../dyn/index.html">Dynamic</a></p><p class="level2"><a href="../../../exsl/index.html">Common</a></p><p class="level2"><a href="../../../func/index.html">Functions</a></p><p class="level2"><a href="../../../math/index.html">Math</a></p><p class="level2"><a href="../../../random/index.html">Random</a></p><p class="level2"><a href="../../../regexp/index.html">Regular Expressions</a></p><p class="level2"><a href="../../../res/index.html">Resource</a></p><p class="level3"><a href="../../functions/document/index.html">res:document()</a></p><p class="level3"><a href="../../attributes/no-indent-elements/index.html">res:no-indent-elements=</a></p><p class="level3"><a href="../../value-sets/xml/index.html">&#8220;res:xml&#8221;</a></p><p class="level2"><a href="../../../set/index.html">Sets</a></p><p class="level2"><a href="../../../str/index.html">Strings</a></p><p class="level2"><a href="../../../sys/index.html">System</a></p><p class="level1"><a href="../../../submissions/">Submissions</a></p><p class="level1"><a href="../../../list">Mailing List</a></p><p class="level1"><a href="../../../contact.html">Contact</a></p></td><td id="content"><p><b>Implementer Page: </b><a href="res.no-indent-elements.html">res.no-indent-elements.html</a><br/><b>Attribute Package: </b><a href="res.no-indent-elements.zip">res.no-indent-elements.zip</a></p><h4>Attribute Syntax</h4><pre>&lt;xsl:output method="res:xml" indent="yes"
            <em>res:no-indent-elements="[tokens]"</em>/&gt;</pre><p>When using the <code>xml</code> output method and
  <code>indent="yes"</code>, an XSLT processor can add whitespace to the
  serialized output tree in order to format it nicely.  The
  <code>res:no-indent-elements</code> attribute selectively disables this
  indenting behavior, to protect branches of the tree that would be
  sensitive to adding additional whitespace.</p><p>For the purposes of this description, consider the <code>xsl</code>
  namespace prefix to be bound to the
  <code>http://www.w3.org/1999/XSL/Transform</code> namespace URI.  When the
  <code>xsl:output</code> element uses the <code>res:xml</code> method and
  <code>indent="yes"</code>, then the <code>res:no-indent-elements</code>
  attribute should be interpreted as a whitespace-separated list of <a href="http://www.w3.org/TR/xpath#NT-NameTest">NameTest</a>s.  The
  processor method may output whitespace in the same fashion as <a href="http://www.w3.org/TR/xslt#section-XML-Output-Method">the built-in
  <code>xml</code> method</a> unless the output values are descendants of
  an element matching one of the NameTests in the
  <code>res:no-indent-elements</code> attribute, in which case the processor
  must not output extra whitespace.  If the <code>xsl:output</code> element
  does not use both the <code>res:xml</code> method and
  <code>indent="yes"</code>, then this attribute has no effect.</p></td></tr></table><div id="colophon"><p><a href="http://www.exslt.org/res/attributes/no-indent-elements/index.html">http://www.exslt.org/res/attributes/no-indent-elements/index.html</a> last modified 2006-02-27</p></div></body></html>
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.7 (GNU/Linux)

iD8DBQFEBAXwjkcskvOyl78RAhbAAJ9csTQ9uRO5OPYyKaeTbjnc+xvSFwCgy3I2
08zqsgMR7a7Ceu3JF+KEwCo=
=jtal
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.