xsl-list
[Top] [All Lists]

[xsl] Re: Output validation with XSLT 2.0

2008-05-03 08:37:40
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>
      <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 ?

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

On 5/3/08, Mukul Gandhi <gandhi(_dot_)mukul(_at_)gmail(_dot_)com> 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.


-- 
Regards,
Mukul Gandhi

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--