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

Re: Re: The Perils of Sudden Type-Safety in XSLT 2.0

Subject: Re: Re: The Perils of Sudden Type-Safety in XSLT 2.0
From: "Kurt Cagle" <kurt@xxxxxxxxxxxxx>
Date: Thu, 27 Feb 2003 00:42:06 -0800
xsl 2.0 padding numbers
I think this discussion misses the point. Changing the version number to
allow/disallow type is at best a kludge. Personally, I think that maybe a
type-safety attribute sitting on the <xsl:stylesheet> node would do the
trick. This would instruct the processor to perform type-safety checking if
enabled, and would turn that feature off if not. This would mean that
non-type-safe code would be less safe but probably more efficient. As
type-safety is pretty much a concession to Microsoft anyway, it seems to me
reasonable to make this a flag. Yes, it makes more work for the
implementation coders ... but so what. I've worked with the type-safe mode
now for a couple of weeks, and frankly, its a pain in the butt that lends
very little real benefit for a lot more work.

-- Kurt


----- Original Message -----
From: "Charles White" <chuck@xxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Tuesday, February 25, 2003 1:46 PM
Subject: Re:  Re: The Perils of Sudden Type-Safety in XSLT 2.0


> ----- Original Message -----
> From: "Gunther Schadow" <gunther@xxxxxxxxxxxxxxxxxxxxxx>
>
> >  Certainly there may still be issues with
> > things like
> >
> > string-pad(' ', @indent + 2)
> >
> > because this would @indent + 2 would probably result in an
> > xs:decimal and not an xs:integer and then there would still be
> > complaints.
>
> Hi Gunther:
>
> Except I think you're forgetting about the solution of changing the
version
> number to 1.0, which, when using XSLT processors that can process 2.0
files,
> will give you access to XSLT 2.0 elements and attributes without the
> datatyping. That is, if I am correctly interpreting Jeni's response
earlier
> in this thread.
>
> That leads to more weirdness, that when you have version="1.0" you are
> sometimes working with 2.0 documents.
>
> I actually did my own tests a week or so ago because you took so long to
> answer the post you answered previously today. <grin/>
>
> The following won't work in Saxon if the version number is 2.0, but will
if
> you change the version number to version="1.0":
>
> <xsl:stylesheet version="2.0"
>   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>   xmlns="http://www.w3.org/1999/xhtml">
>
>   <xsl:output method="html"/>
>     <xsl:variable name="import" select="products" />
>
>   <xsl:template match="/">
>     <html>
>       <head>
>         <title>Links to text documents</title>
>       </head>
>       <body>
>         <p>Click a link to view the files output for this stylesheet</p>
>         <ul>
>           <xsl:apply-templates select="products/product"/>
>         </ul>
>       </body>
>     </html>
>   </xsl:template>
>
>   <xsl:template match="product">
>     <xsl:variable name="doclink"
> select="normalize-space(concat(local-name(), position(), '.htm'))"/>
>
>     <li>
>       <a href="{$doclink}">
>         <xsl:value-of select="string-pad($doclink, 1)"/>
>       </a>
>     </li>
>
>   </xsl:template>
>
> </xsl:stylesheet>
>
> Oh, and this is the source document:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <products>
> <product >
>  <name>Bert&apos;s Coffee</name>
>  <quantity>1</quantity>
>  <quantity>3</quantity>
>  <quantity>3.4</quantity>
>  <quantity>8</quantity>
>  <selldate>2003-01-21</selldate>
> </product>
> <product >
>  <name>Bert&apos;s Tea</name>
>  <quantity>11</quantity>
>  <quantity>22</quantity>
>  <quantity>11.5</quantity>
>  <quantity>8</quantity>
>  <selldate>2003-02-21</selldate>
> </product>
> <product >
>  <name>Bert&apos;s Soda</name>
>  <quantity>3</quantity>
>  <quantity>2</quantity>
>  <quantity>5</quantity>
>  <quantity>1.5</quantity>
>  <selldate>2002-02-15</selldate>
> </product>
> </products>
>
> The offending statement is this:
>
>  <xsl:variable name="doclink" select="normalize-space(concat(local-name(),
> position(), '.htm'))"/>
>
> I only used the string-pad function to see if I could use XPath 2.0
> functions in Saxon while (or, for you English folks out there, whilst)
using
> 1.0 as the version attribute value, and found that I could.
>
> Of course, you can fix the above statement and make it work with
> version="2.0" by doing this:
>
>  <xsl:variable name="doclink" select="normalize-space(concat(local-name(),
> string(position()), '.htm'))"/>
>
> But you don't have to even do that, you can just change the stylesheet's
> version attribute value to 1.0.
>
> So, in summary, it seems as though data typing is available if you want it
> to be, and not available if you don't want it to be. If you don't want it
to
> be, you use version="1.0", and you still get to use XSLT/XPath 2.0 syntax,
> without type casting. If you do want a stricter type casting model, you
use
> version="2.0".
>
> Please, somebody correct me if my interpretation is erroneous!!
>
> I'm not against strict data typing ***IF*** there's a clean way out, and
> there seems to be, sort of.
>
> Cheers,
>
>
> Chuck White
> Author, Mastering XSLT, Sybex Books
> http://www.javertising.com/webtech
> http://www.tumeric.net
>
>
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.