Validation passes but should not v8.2

Having trouble installing Oxygen? Got a bug to report? Post it all here.
angela
Posts: 11
Joined: Tue Jan 30, 2007 10:28 pm

Validation passes but should not v8.2

Post by angela »

Validation errors are not being caught when a custom validation scenario is used.

I've created a file called junk.xsl that contains the xsl listed below. I configure a custom validation scenario pointing to master.xsl as the main file.

My master.xsl file does not include or import the junk.xsl file, nor does any other file master.xsl does include. Oxygen reports 'no problems found' in the following xsl (from junk.xsl). If I remove the custom validation scenario, the validation displays the expected errors around the stylesheet mismatch, the unclosed node tag and the undeclared variable.

[code]<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="label">
<xsl:value-of select="$I-Know-This-Variable-Has-Not-Been-Declared-As-Of-July11-2007"

Just some random junk

</xsl:template>

</xsl:transform>[/code]
Thanks!
Angela Williams
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Hello,

If the file specified in the validation scenario, in your case master.xsl does not include or import the current file, in your case junk.xsl then the validation operation cannot report any validation error in the current file. The validation checks the file specified in the validation scenario so it reports errors in that file and any files imported or included by that file. Defining a validation scenario does not make sense in your case. A scenario is useful when the current XSLT stylesheet uses a template or a variable declared in other stylesheet and it must be validated in the context of that stylesheet in order to have all the declarations available just as it happens when the current file is used in the XSLT transformation.


Regards,
Sorin
angela
Posts: 11
Joined: Tue Jan 30, 2007 10:28 pm

Post by angela »

Your reply does not make sense. I know when and why to use the validation scenario. I gave a clear example that should absolutely fail validation and it did not.

I found the issue because the original file WAS included in the master.xsl which fixed validation errors on variable names declared in other imported files.

In that case, that is the ONLY validation that occurred, though. None of my syntax errors in the included file failed validation. To illustrate this, I created the junk.xsl file that should clearly not pass any standard of validation and it still did.

When a file is included in a validation scenario, the only validation that occurs is to make sure variables, functions, attribute-sets, and named templates declared elsewhere do not error when used within other files. It should ALSO still perform all other standard validation AND IT DOES NOT.

Don't take my word for it. Please test this out using the previously posted xsl and any xsl as the master that includes that file.
Thanks!
Angela Williams
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Dear Angela,

When you define a validation scenario the validate action executes that scenario only and does not apply any other validation on the current file. So, if you specify an XSL file that does not include/import the current file directly or indirectly then the current file will not be validated at all because the validation scenario will validate only the master file.

I saved your file as incl.xsl and I created a master file master.xsl. I set a validation scenario for incl.xsl to validate the master.xsl file.
Now the expected behavior is as below.

1. If the master file contains

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:include href="incl.xsl"/>
</xsl:stylesheet>
I get errors.

2. If the master file is

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">

</xsl:stylesheet>
I get no errors when applying the validate action on incl.xsl.
That is because in both cases the validation is performed on the master.xsl file and in the first case incl.xsl is alse validated because it is included in that file while in the second case it is not validated because master.xsl dos not refer to it.

I hope the above clarifies how validation scenarios work.
If you still have issues please post a complete example to avoid any possible confusions.

Best Regards,
George
George Cristian Bina
Post Reply