Altova Mailing List Archives
>xsl-list Archive Home
>Thread Prev - How is this part of the XSLT specification to be interpreted?
Re: How is this part of the XSLT specification to be interpreted?
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