Altova Mailing List Archives


Re: How is this part of the XSLT specification to be interpreted?

From: David Carlisle <davidc@--------->
To:
Date: 6/21/2000 12:13:00 PM
me> .... use <fallback/>....

Specifically

==================================
<xxx xmlns="http://a/b/c">
  <b a="2">
    <x:c xmlns:x="http:/x/y/z"/>
  <c>text</c>
  </b>
</xxx>
==================================

could be transformed to


==================================
<?xml version="1.0" encoding="utf-8" ?>
<x xmlns:y="http:/x/y/z">[xxx]</x>
<x:c xmlns:x="http:/x/y/z" xmlns="http://a/b/c"/>
==================================

by the stylesheet below.

It _is_ transformed to that using saxon.

xt and oraxsl (or at least the version I have, which may not be the latest)
don't support extension elements, so the documentation appears as
literal result elements in the output.

xalan (again, I'm not sure if this is the latest version) just dies
Error! com.ibm.bsf.BSFManager
Xalan: was not successful.
XSLProcessor: done

But here is the stylesheet, it uses two elements in a documentation
namespace, one for documenting templates and one for documenting select
expressions. An XSLT stylesheet could easily take in this format and
pretty print the code below making for example the select expression be
an active link to its documentation.

David


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0"
  extension-element-prefixes="doc"
  exclude-result-prefixes="main"
  xmlns:doc="http://doc.com"
 xmlns:main="http://a/b/c"
 xmlns:y="http:/x/y/z"
                >

<xsl:output method="xml" indent="yes"/>


<xsl:template match="main:xxx">
 <doc:template><xsl:fallback/>
 some doc about <emph>this</emph>  template
 </doc:template>
 <x>[<xsl:value-of select="name()"/>]</x>
 <doc:select><xsl:fallback/>
 this select attribute selects grandchildren
 </doc:select> 
 <xsl:apply-templates select="*/*"/>
</xsl:template>


<xsl:template match="y:c">
 <doc:template><xsl:fallback/>
 some doc about <emph>this</emph> template, it matches 
 and copies c element nodes
 </doc:template>
 <xsl:copy-of select="."/>
</xsl:template>

</xsl:stylesheet>




Actually looking at it now in the mail buffer, perhaps it would have
been better to have put the xsl:copy expression _inside_ the fallback
rather than after the doc:select. Obviously the stylesheet that is
controlling the pretty printing basically controls what forms are
allowed.





 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.