[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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


Subject: RE: [xsl] Re: Output validation with XSLT 2.0
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 6 May 2008 11:20:23 +0100

A rule that said "the namespace is excluded if it is only ever used to
qualify the names of functions" would seem rather complex. It's good to keep
things simple.

Michael Kay
http://www.saxonica.com/
 

-----Original Message-----
From: Mukul Gandhi [mailto:gandhi.mukul@xxxxxxxxx] 
Sent: 06 May 2008 11:12
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Re: Output validation with XSLT 2.0

The following example could also be worth discussing ...

Please consider this 2.0 stylesheet:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                        xmlns:xs="http://www.w3.org/2001/XMLSchema"
                        xmlns:a="http://localhost/myfunctions"
                        version="2.0">

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

  <xsl:template match="/">
    <result>
      <xsl:value-of select="a:f()" />
    </result>
  </xsl:template>

  <xsl:function name="a:f" as="xs:integer">
    <xsl:sequence select="10" />
  </xsl:function>

</xsl:stylesheet>

The output produced is:
<?xml version="1.0" encoding="UTF-8"?>
<result xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:a="http://localhost/my functions">10</result>

Logically, I think (from end user's point of view) having the function
namespace by default coming into the output is not that good.

I would like to learn, what did the language designers had in mind (i.e.,
the logic behind it), while deciding what namespace should be copied to the
output and which not ?

On 5/6/08, David Carlisle <davidc@xxxxxxxxx> wrote:
>
> > Indeed, I'm not proposing any changes, it's no big deal - just 
> > pointing out (or perhaps looking for confirmation) that the xml 
> > schema namespace could easily have been excluded by default.
>
> If "to" had allowed double as well as integer then most stylesheets 
> could easily avoid declaring the xs namespace, which would make the 
> whole problem go away. If you are really using an XSD-specific 
> datatype such as date handling, it seems to me perfectly reasonable to 
> have to declare (and exclude) the xs namespace, but I do curse every 
> time I have to add an xs namespace just so I can go
> select="1 to xs:integer(something)"
>
> David


--
Regards,
Mukul Gandhi


Current Thread
Keywords