Subject: Re: [xsl] XSLT 3.0 processor accepting non well-formed XML inputs From: "Mukul Gandhi gandhi.mukul@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Sun, 3 Mar 2019 05:35:41 -0000 |
Hi Martin, On Fri, Mar 1, 2019 at 5:07 PM Martin Honnen martin.honnen@xxxxxx < xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote: > If you use Saxon 9.8 or 9.9 EE and streaming and for instance an > `xsl:iterate` with an `xsl:break` then you will find that it indeed > abandons parsing the input so non-wellformedness violations can go > unnoticed. > I tried this with Saxon 9.9 EE, and observed results (for small enough input XMLs) contrary to your claim. Below is my example, Input XML (which is well-formed): <?xml version="1.0" encoding="UTF-8"?> <foo> <val>5</val> <val>4</val> <val>3</val> <val>0</val> <val>2</val> <val>0</val> <val>7</val> </foo> XSLT 3.0 stylesheet: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0"> <xsl:output method="xml" indent="yes"/> <xsl:mode streamable="true"/> <xsl:template match="foo"> <result> <xsl:iterate select="*"> <xsl:choose> <xsl:when test=". != '0'"> <mesg> <xsl:value-of select="'hello'"/> </mesg> </xsl:when> <xsl:otherwise> <xsl:break/> </xsl:otherwise> </xsl:choose> </xsl:iterate> </result> </xsl:template> </xsl:stylesheet> After the transformation, I get following output, <?xml version="1.0" encoding="UTF-8"?> <result> <mesg>hello</mesg> <mesg>hello</mesg> <mesg>hello</mesg> </result> When I change input document to following (deliberately making it non-wellformed at the bottom), <?xml version="1.0" encoding="UTF-8"?> <foo> <val>5</val> <val>4</val> <val>3</val> <val>0</val> <val>2</val> <val>0</val> <val> </foo> With the same stylesheet, I now get following output, Error on line 10 column 3 of foo.xml: SXXP0003: Error reported by XML parser: The element type "val" must be terminated by the matching end-tag "</val>". org.xml.sax.SAXParseException: The element type "val" must be terminated by the matching end-tag "</val>". -- Regards, Mukul Gandhi alt email : mukulgandhi@xxxxxxx
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSLT 3.0 processor accept, Martin Honnen martin | Thread | Re: [xsl] XSLT 3.0 processor accept, Martin Honnen martin |
Re: [xsl] XSLT 3.0 processor accept, Mukul Gandhi gandhi. | Date | Re: [xsl] XSLT 3.0 processor accept, Martin Honnen martin |
Month |