[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Re: Output validation with XSLT 2.0

Subject: Re: Re: Output validation with XSLT 2.0
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Tue, 6 May 2008 15:41:47 +0530
Re:  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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.