|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Announce: XML Schema, The W3C's Object-OrientedDescription
Hi Jeni, On Wed, 2002-06-26 at 15:34, Jeni Tennison wrote: > For example, if you had something like: > > <length>12.5<unit>cm</unit></length> Note that this model is only a (simple) XSLT transformation away from something more "classical" and that (for instance) <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="length/text()[normalize-space()]"> <value> <xsl:value-of select="."/> </value> </xsl:template> <xsl:template match="*|@*"> <xsl:copy> <xsl:apply-templates select="@*|*|text()"/> </xsl:copy> </xsl:template> </xsl:transform> would transform it into <length><value>12.5</value><unit>cm</unit></length> which is much easier to validate with any schema language. That's here that xvif can help and let you write: <?xml version="1.0" encoding="iso-8859-1"?> <element xmlns="http://relaxng.org/ns/structure/1.0" name="length"> <if:transform type='http://www.w3.org/1999/XSL/Transform' xmlns:if='http://namespaces.xmlschemata.org/xvif/iframe'> <if:apply xmlns=""> <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="length/text()[normalize-space()]"> <value> <xsl:value-of select="."/> </value> </xsl:template> <xsl:template match="*|@*"> <xsl:copy> <xsl:apply-templates select="@*|*|text()"/> </xsl:copy> </xsl:template> </xsl:transform> </if:apply> </if:transform> <element name="value"> <text/> </element> <element name="unit"> <text/> </element> </element> (this is embedded into Relax NG but I am pretty confident that this could be implemented on top of WXS as well). Eric PS: you can try it on http://downloads.xmlschemata.org/python/xvif/tryMe.cgi -- See you in San Diego. http://conferences.oreillynet.com/os2002/ ------------------------------------------------------------------------ Eric van der Vlist http://xmlfr.org http://dyomedea.com (W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema ------------------------------------------------------------------------
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Cast Your Vote
We need your help – Vote for DataDirect XML Products!
Winners and finalists announced at SOA World Conference in November. Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||







