Subject: Re: [xsl] Validated input From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx> Date: Wed, 24 Sep 2008 11:05:18 +0100 |
2008/9/24 Colin Paul Adams <colin@xxxxxxxxxxxxxxxxxx>: >>>>>> "Andrew" == Andrew Welch <andrew.j.welch@xxxxxxxxx> writes: > > Andrew> The problem I have with schema-aware xslt (specifically > Andrew> input validation) is that your transform then relies on > Andrew> the input being validated... the XML is no longer > Andrew> sufficient on its own. The output will be different > Andrew> depending on whether the input has been validated or not, > Andrew> which is not a good thing. > > I would have thought it would be a good thing to get different output > (i.e. an error message) for invalid input than for valid input. > > Of course, that is not what you said. But I think you should be able > to detect un-validated input and issue an error. sure, it's no problem to detect: <xsl:template match="document-node(schema-element(the-root-element))"> normal case </xsl:template> <xsl:template match="/"> error case </xsl:template> > That way you can be assure of having correct data. The data would be correct in both cases - say for example you process the same XML a hundred times, you only need to check for correctness once, but if you rely on the type annotations after validation then you need to validate that XML every time you process it... which just seems the wrong way to go, especially when you can code around the benefits anyway. I guess it only applies to repeatedly processing the same XML file... where the content of the XML is different each time, then validating each instance makes sense. In my limited experience of schema-aware transforms, result validation is always great. It's easy to code and switch on/off, and really speeds up development. Transforming to XHTML transitional/strict is something that probably happens a lot out there, and would really benefit from result validation (anyone transforming to any format that has a schema should check out result validation...) I'm not overly convinced about input validation yet, but I haven't really used it that much - anyone have any opinions either way? After being stung by dtd defaulted values, I really don't like the idea of the XML being different after validation. -- Andrew Welch http://andrewjwelch.com Kernow: http://kernowforsaxon.sf.net/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Validated input, Colin Paul Adams | Thread | Re: [xsl] Custom function in templa, Florent Georges |
[xsl] Validated input, Colin Paul Adams | Date | Re: [xsl] Include ASCII29 in output, David Carlisle |
Month |