xsl-list
[Top] [All Lists]

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

2008-05-06 03:21:07

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(_dot_)mukul(_at_)gmail(_dot_)com] 
Sent: 06 May 2008 11:12
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
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(_at_)nag(_dot_)co(_dot_)uk> 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

--~------------------------------------------------------------------
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>
--~--


--~------------------------------------------------------------------
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>
--~--