[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XSLT 3.0 processor accepting non well-formed XML
Determining exactly when early exit is and isn't possible is quite subtle. In this case early exit would be possible in theory, if Saxon were a bit smarter: * you have to know that the input XDM tree is coming straight from an XML parser, therefore it is supposed to be a well-formed instance with only one top-level element * you have to know that comments and processing instructions generate no output, because there are no template rules that match them, and the default template rules for comments and PIs do nothing. If there were a second template rule <xsl:template match="comment()">*****</xsl:template> then Saxon would clearly have to continue parsing to the end just in case of possible comments. Generally, if early termination is important to you, then it's best to start with a template rule saying match="/". You would get early termination for this stylesheet (I think) if you wrote > <xsl:template match="/"> > <result> > <xsl:iterate select="/foo/*"> > <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> Michael Kay Saxonica
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! 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
|