[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: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 9 Jun 2024 15:51:52 -0000
Re:  Is there any benefit to creating a variable and  s
On 09/06/2024 17:38, Roger L Costello costello@xxxxxxxxx wrote:
> What is the right way to get a parameter validated against an XSD type?


See below (use the as attribute with the simple type name, make sure if
it is in a namespace that you declare a prefix and qualify the type name
with the prefix):


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 B  version="3.0"
 B  xmlns:xs="http://www.w3.org/2001/XMLSchema"
 B  exclude-result-prefixes="#all"
 B  expand-text="yes">

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


 B  <xsl:param name="ICAO" as="ICAOtype"/>

 B  <xsl:template match="/" name="xsl:initial-template">
 B B B  <test>{$ICAO}</test>
 B  </xsl:template>

</xsl:stylesheet>

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.