Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] Re: Output validation with XSLT 2.0

From: "G. Ken Holman" <gkholman@-------------------->
To:
Date: 5/3/2008 4:11:00 PM
At 2008-05-03 21:06 +0530, Mukul Gandhi wrote:
If I modify the example (as given in my blog post) as follows (with
rest of the things remaining same), which seems more logical to me:

  <xsl:template match="/">
    <xsl:variable name="temp1">
      <x>
        <y />
      </x>
    </xsl:variable>
    <xsl:variable name="temp2">
      <p>
        <q />
      </p>
    </xsl:variable>
    <result>

The above is a literal result element, and so has attached to it all 
ancestral namespace nodes that are not pruned through use of 
exclude-result-prefixes= ... just like any other literal result element.



      <xsl:copy-of select="$temp1" validation="strict" />
      <xsl:copy-of select="$temp2" validation="strict" />
    </result>
  </xsl:template>

Now I specify validation="strict" on xsl:copy-of instruction.



The output produced is (with Saxon-SA 9):



<?xml version="1.0" encoding="UTF-8"?>
<result xmlns:xs="http://www.w3.org/2001/XMLSchema">
   <x>
      <y/>
   </x>
   <p>
      <q/>
   </p>
</result>

Why does the processor generate the namespace declaration,
xmlns:xs="http://www.w3.org/2001/XMLSchema" on the <result tag ?

Because you didn't prune it.



To avoid this I have to do, exclude-result-prefixes="xs" on the
xsl:stylesheet element.

Just like you would have to in order to prune extension namespace 
nodes off of literal result elements.



There is nothing special about the schema namespace that implies 
pruning.  The XSLT namespace is implicitly pruned, except (it seems), 
when a namespace alias for XSLT is being used.



Anyway, unused namespace declarations are innocuous in the result, so 
this is only an aesthetic issue.



I hope this helps.



. . . . . . . . . . . . Ken



On 5/3/08, Mukul Gandhi <gandhi.mukul@xxxxxxxxx> wrote:

> Hi all,

>  I posted my thoughts about this topic on my blog

> 
(http://mukulgandhi.blogspot.com/2008/05/output-validation-with-xslt-20.html).

>

> I would like to hear the list member's opinion about this example, and

> to know the best practices to import schemas, use namespaces etc. for

> this particular scenario.




--
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds:     publicly-available developer resources and training
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


transparent
Print
Mail
Like It
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.

.
.

transparent

transparent