Hi Wendell,
You need to use xsl:import-schema to load the schema in the stylesheet
and then you should use schema-element(element) instead of an element
test in your XPath, for example, if you put the following stylesheet in
the oXygen samples folder (where we have the sample project, next to
personal.xsl):
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsl:import-schema schema-location="personal.xsd"/>
<xsl:template match="/schema-element(email)/test">
<test/>
</xsl:template>
<xsl:template match="/schema-element(a)/x">
<x/>
</xsl:template>
</xsl:stylesheet>
and you set Saxon-SA 9.1.x.x in Options->Preferences -- XML /
XSLT-FO-XQuery / XSLT -- XSLT 2.0 Validate with then you should get the
following errors when you compile the stylesheet:
SystemID: C:\Program Files\Oxygen XML Editor 10\samples\personal.xsl
Description: [Saxon-SA 9.1.0.3] Failed to compile stylesheet. 1 error
detected.
SystemID: C:\Program Files\Oxygen XML Editor 10\samples\personal.xsd
Location: 126:0
Description: [Saxon-SA 9.1.0.3] For compatibility, a notation should not
have both a public identifier and a system identifier
SystemID: C:\Program Files\Oxygen XML Editor 10\samples\personal.xsl
Location: 10:0
Description: [Saxon-SA 9.1.0.3] XSLT Pattern syntax error at char 18 on
line 10 in {/schema-element(a)/x}:
There is no declaration for element <a> in an imported schema
URL: http://www.w3.org/TR/xpath20/#ERRXPST0008
SystemID: C:\Program Files\Oxygen XML Editor 10\samples\personal.xsl
Location: 7:0
Description: [Saxon-SA 9.1.0.3] The child axis will never select any
element nodes when starting at a node with simple type xs:string
The -val option is for strict validation.
Hope that helps,
George
--
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Wendell Piez wrote:
Gentlemen,
I am trying out features of schema-aware transformations. I am aware
that one of the things SaxonSA is supposed to be able to do is signal
errors when XPath expressions in your XSLT would resolve in empty
sequences by necessity (given valid input), since the elements named
would be invalid according to the given schema. (This is documented on
pp 169-170 of Michael Kay's Programmers Reference, 4th ed., and
elsewhere.) But I can't get this to work in oXygen. SaxonSA happily runs
my transform without emitting warnings, even when I put spurious XPath in.
On p 169 of the PR 4ed, Mike indicates that -val:strict has to be
provided from the command line. In oXygen's Preferences, I can see how
to set -val, but not -val:strict. Might that have to do with why this
feature isn't working for me?
This is just a guess, since Saxon does complain if input is not valid.
Otherwise I'm completely in the dark. I'd be grateful for any tips.
I'm still on oXygen 10; the version of SaxonSA is 9.1.0.3J.
Thanks!
Wendell
======================================================================
Wendell Piez mailto:[email protected]
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
_______________________________________________
oXygen-user mailing list
[email protected]
http://www.oxygenxml.com/mailman/listinfo/oxygen-user
_______________________________________________
oXygen-user mailing list
[email protected]
http://www.oxygenxml.com/mailman/listinfo/oxygen-user