Subject: Re: [xsl] 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 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Is there any benefit to c, Martin Honnen martin | Thread | Re: [xsl] Is there any benefit to c, Martin Honnen martin |
Re: [xsl] Is there any benefit to c, Martin Honnen martin | Date | Re: [xsl] Is there any benefit to c, Martin Honnen martin |
Month |