Hi George,

thanks for the hint for schematron + xslt. It will probably work for most of my cases.

However, this doesn't seem to work for schematron included into xsd. Here is what I tried:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
       xmlns:xs="http://www.w3.org/2001/XMLSchema"
       xmlns:sch="http://www.ascc.net/xml/schematron"
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
       xmlns:gdvdl="http://www.gdv-dl.de"
       elementFormDefault="qualified">
       
       
<xs:include schemaLocation="gdvdl-generic-book.xsd"/>
       
<xs:include schemaLocation="gdvdl-generic-topic.xsd"/>
       
<xs:include schemaLocation="gdvdl-generic-inline.xsd"/>
       
       
<xs:annotation>
               
<xs:appinfo>
                       
<sch:ns prefix="gdvdl" uri="http://www.gdv-dl.de"/>
                       
                       
<xsl:function name="gdvdl:test" as="xs:boolean">
                               
<xsl:param name="Input" as="xs:string"/>
                               
<xsl:sequence select="string-length($Input) = 3"/>
                       
</xsl:function>
                       
                       
<sch:pattern>
                               
<rule context="title" role="warn">
                                       
<assert test="gdvdl:test(.)">The title should contain exactly 3 characters.</assert>
                               
</rule>
                               
<rule context="title" role="warn">
                                       
<assert test="string-length(.) = 4">The title should contain exactly 4 characters.</assert>
                               
</rule>
                       
</sch:pattern>
               
</xs:appinfo>
       
</xs:annotation>
       
       
<xs:element name="book" type="bookType"/>
       
<xs:element name="chapter" type="chapterType"/>

</xs:schema>
The first rule produces an error:
        Cannot find a matching 1-argument function named {http://www.gdv-dl.de}test()
So I have to extract the more complex schematron-rules (those using xslt) into a separate schematron file? (Just curious. This would be no problem.)

The enhancement request sounds great.
Just an idea: A less comfortable but easier (=sooner?) to implement alternative might be to parse the xsl output messages the same way you already parse the output of an external validator!?

Thanks,

Patrik

------------------------------------------------------------------
Systemarchitektur & IT-Projekte
Tel: +49 40 33449-1142
Fax: +49 40 33449-1400
E-Mail: patrik.stellmann@gdv-dl.de




Von:        George Cristian Bina <george@oxygenxml.com>
An:        Patrik.Stellmann@gdv-dl.de
Kopie:        oxygen-user@oxygenxml.com
Datum:        28.05.2013 10:31
Betreff:        Re: [oXygen-user] Link xslt output messages to xml document
Gesendet von:        oxygen-user-bounces@oxygenxml.com




Hi Patrick,

oXygen's Schematron implementation is based on Skeleton and it allows
adding XSLT functions/named templates in your Schematron file and these
will be copied to the XSLT that represents the compiled Schematron, thus
you can call them from your checks. You need to enable
Options->Preferences -- XML / XML Parser / Schematron -- "Allow foreign
elements" to enable this functionality. You may want to explore if this
is enough to implement your checks in Schematron.

We have an enhancement request logged on our issue tracking systenm to
define an XML language that should be interpreted by oXygen as a list of
results and displayed in the results area like we currently show the
list of errors. If this will be generated by an XSLT stylesheet then we
will show the list of problems instead of the actual XML. But this is
not available now...

Though the XSLT message output you cannot do much I am afraid... you may
generate an XPath expression that matches the node with the problem and
put that in the message, then you can copy that and paste it in the
XPath evaluation window to select that node.

Best Regards,
George
--
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

On 5/28/13 8:56 AM, Patrik.Stellmann@gdv-dl.de wrote:
> Hi,
>
> I would like to have my xslt output messages being linked to a node of
> the processed xml document rather then to the xslt script - preferably
> even with a differentiation between warnings and errors.
> (The use-case is that my transformation scenario can detect several
> errors in the processed document that can hardly be covered by
> schema/schematron. So the author should be able to easily jump to the
> position in the document to fix it.)
>
> I already managed to create a custom validation by calling saxon and
> passing the xslt script as argument. However, this is pretty slow and
> doesn't feel being the right way.
>
> Thanks for any hints.
>
> Patrik Stellmann
>
> *GDV Dienstleistungs-GmbH & Co. KG*
> Glockengießerwall 1
> D-20095 Hamburg
>
www.gdv-dl.de
>
> _______________________________________________
> oXygen-user mailing list
> oXygen-user@oxygenxml.com
>
http://www.oxygenxml.com/mailman/listinfo/oxygen-user
>
_______________________________________________
oXygen-user mailing list
oXygen-user@oxygenxml.com
http://www.oxygenxml.com/mailman/listinfo/oxygen-user

GDV Dienstleistungs-GmbH & Co. KG
Glockengießerwall 1
D-20095 Hamburg
www.gdv-dl.de

Sitz und Registergericht: Hamburg
HRA 93 894
USt.-IdNr : DE 205183123

Komplementärin:
GDV Beteiligungsgesellschaft mbH
Sitz und Registergericht: Hamburg
HRB 71 153

Geschäftsführer:
Volker Sonnenburg
Heiko Beermann

------------------------------------------------------------------
Diese E-Mail und alle Anhänge enthalten vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe der E-Mail ist nicht gestattet.

This e-mail and any attached files may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distributionof the material in this e-mail is strictly forbidden.