Project

Profile

Help

Problem applying XSL xsl:copy-of when sub node has attribute xsi:type defined in a private schema

Added by Anne FAVEUR over 1 year ago

Greetings,

We have been so far using PHP default XSLT processor (libxslt) but would like to benefit from XSLT2 features at least. I am trying to test our current XSLs with " Saxon/C 1.1.0 running with Saxon-HE 9.8.0.4J" but I am stuck on the following problem:

XTTE1510: Unknown xsi:type in element being validated: SegmentStayType

which apparently appears because we are using xsl:copy-of on a node whose subnodes contains elements like : <Segment xsi:type="SegmentStayType">

I have trouble understanding why the processor would try to validate the output, especially as I am using HE version which is not suppose to be able to validate, but in any case, I cannot find the way to avoid validating. We have tested the XSL using Oxygen and specifying the saxon engine, (java version) and everything is ok (may be this is not the exact same saxon version of 9.8). So what am I doing wrong?

I would greatly appreciate your help.


Replies (4)

Please register to reply

RE: Problem applying XSL xsl:copy-of when sub node has attribute xsi:type defined in a private schema - Added by O'Neil Delpratt over 1 year ago

Hi,

Thanks for reporting the issue you are having. Please can you send the code snippet or add it to this forum post.

It is highly possible the Saxon-HE 9.8.0.4 version used in Saxon/C has a bug which has since been fixed in a maintenance release on Java.

RE: Problem applying XSL xsl:copy-of when sub node has attribute xsi:type defined in a private schema - Added by Anne FAVEUR over 1 year ago

Hi,

Thank you for your quick response. We have prepared a special test which I join here.

to launch : php phptest.php xml=RQ.xml xsl=xsl.xsl Right now (this version of the xsl), it will fail with the above mentionned error

Error at char 23 in xsl:copy-of/@select on line 34 column 60 of xsl.xsl: XTTE1510: Unknown xsi:type in element being validated: SegmentProductType in built-in template rule for /Actions in the unnamed mode

However, commenting lines 33-35 of the xsl will enable process to complete. It seems that the problem arises when the "first" node copied by the copy-of have @xsi:type but if not, even if children have @xsi:type attribute, it will correctly proceed. as demonstrated by line 26 or 30 of the xsl.

Thanks

phptest.php (1.53 KB) phptest.php
RQ.xml (92 KB) RQ.xml
xsl.xsl (1.54 KB) xsl.xsl

RE: Problem applying XSL xsl:copy-of when sub node has attribute xsi:type defined in a private schema - Added by O'Neil Delpratt over 1 year ago

Thanks for sending the files. As it turns out this is a bug which was fixed in Saxon-HE version 9.8.0.8.

It is related to bug issue: #3062 Also some notes of the bug issue on the forum post see: https://saxonica.plan.io/boards/3/topics/7084

There will be a Saxon/C maintenance release to the latest 9.8 version in the early part of the new year.

In the meantime as a workaround as suggested in above forum post you can add the attribute @default-validation="preserve"@ to the xsl:copy-of instruction. See code snippet below of the affected code:

<Segments>
     <xsl:copy-of select="descendant::xft:Segment" default-validation="preserve"/>
</Segments>

RE: Problem applying XSL xsl:copy-of when sub node has attribute xsi:type defined in a private schema - Added by Anne FAVEUR over 1 year ago

Thank you so much for your quick response. I especially appreciate the work-around. Nice. We can then proceed and this is great!

    (1-4/4)

    Please register to reply