Schematron / schematron

Schematron "skeleton" - XSLT implementation
MIT License
93 stars 45 forks source link

How to recursively validate referenced files? #53

Closed PStellmann closed 7 years ago

PStellmann commented 7 years ago

Is there already any mechanism that allows me to recursively validate referenced files as well - e.g. when validating a DITA map to also automatically validate the referenced topics and submaps?

If not, has anybody already thought about how this could look like? Preferably without modifying the Schematron Standard?

Patrik

nkutsche commented 7 years ago

Hi Patrick,

I'm using in Oxygen this template to respect also xsl:include during XSLT validation with Schematron.

<xsl:template match="xsl:include"
    mode="M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 M12 M13 M14 M15 M16 M17 
    M18 M19 M20 M21 M22 M23 M24 M25 M26 M27 M28 M29 M30 M31 M32 M33 M34 M35 M36 M37 M38 M39 M40 M41 
    M42 M43 M44 M45 M46 M47 M48 M49 M50 M51 M52 M53 M54 M55 M56 M57 M58 M59 M60 M61 M62 M63 M64 M65 
    M66 M67 M68 M69 M70 M71 M72 M73 M74 M75 M76 M77 M78 M79 M80 M81 M82 M83 M84 M85 M86 M87 M88 M89 
    M90 M91 M92 M93 M94 M95 M96 M97 M98 M99 M100"
    priority="100000000000">
    <xsl:next-match/>
    <xsl:variable name="href" select="resolve-uri(@href, base-uri(.))"/>
    <xsl:if test="doc-available($href)">
        <xsl:apply-templates mode="#current" select="doc($href)"/>
    </xsl:if>
</xsl:template>

I think you can do it similar for DITA.

BR, Nico

PStellmann commented 7 years ago

Thanks for the hint, Nico

However, I realized that there can't be a general solution purely with (Saxon-)XSLT since DITA processing highly depends on attribute defaults being added. And at least Saxon supports only a single schema for each namespace. But every DITA file might use a different Schema. So the processing will need some mechanism outside of XSLT to load the individual files and expand the attribute defaults...

Patrik