Subject: Re: [xsl] XSLT program that generates XSD, the XSD has a pattern facet, the regex has curly braces, the curly braces are causing me trouble From: "G. Ken Holman g.ken.holman@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Wed, 19 Jul 2017 13:11:17 -0000 |
I am writing an XSLT program that outputs an XML Schema.
The generated XML Schema is to contain a simpleType, with a pattern facet. Its regex is to express: zero or more lowercase letters of the English alphabet, the left curly brace, and the right curly brace:
<xs:simpleType name="Stuff"> <xs:restriction base="xs:string"> <xs:pattern value="[a-z\{\}]*" /> </xs:restriction> </xs:simpleType>
The curly braces are special symbols in the regex language, so I escaped them: \{ and \}
Interestingly, the curly braces are also special symbols in the XSLT language. That's causing me problems.
Below is my XSLT program. It doesn't work - an error is generated because of the curly braces.
Note that replacing the curly braces with their character references also failed:
<xs:pattern value="[a-z\{\ }]*" />
What's the right way to do this?
<xs:restriction base="xs:string"> <xs:pattern value="[a-z\{{\}}]*" /> </xs:restriction>
-- Contact info, blog, articles, etc. http://www.CraneSoftwrights.com/s/ | Check our site for free XML, XSLT, XSL-FO and UBL developer resources | Streaming hands-on XSLT/XPath 2 training class @ US$45 (5 hours free) |
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSLT program that generat, David Carlisle d.p.c | Thread | Re: [xsl] XSLT program that generat, Michael Kay mike@xxx |
Re: [xsl] XSLT program that generat, David Carlisle d.p.c | Date | [xsl] Using variables in xpath expr, Joseph L. Casale jca |
Month |