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

Re: Is there any benefit to creating a variable and s

Subject: Re: Is there any benefit to creating a variable and specifying as="xs:string"?
From: "Roger L Costello costello@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 9 Jun 2024 15:37:44 -0000
Re:  Is there any benefit to creating a variable and  s
Martin wrote:
------------------------------
In schema-aware XSLT 2 or later I think you might be able to import a
schema that defines a type with some restrictions so that some of your
constraints are ensured and use that type in the "as" attribute.
------------------------------

That sounds like an excellent approach Martin. So, I created an XSD with this
type definition:

    <xs:simpleType name="ICAOtype">
        <xs:restriction base="xs:string">
            <xs:length value="4"/>
            <xs:pattern value="[A-Z]+"/>
        </xs:restriction>
    </xs:simpleType>

In my XSLT program I imported the XSD:

<xsl:import-schema schema-location="ICAO.xsd"/>

For the param, I figured that I could add xsl:type, like this:

<xsl:param name="ICAO" xsl:type="ICAOtype"/>

But that results in this error message:

Attribute @xsl:type is not allowed on element <xsl:param>

Removing "xsl:" results in a similar error message:

<xsl:param name="ICAO" type="ICAOtype"/>

What is the right way to get a parameter validated against an XSD type?

/Roger

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.