Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

XInclude support #86

Closed
nkutsche opened this issue Aug 7, 2019 · 1 comment
Closed

XInclude support #86

nkutsche opened this issue Aug 7, 2019 · 1 comment

Comments

@nkutsche
Copy link
Contributor

nkutsche commented Aug 7, 2019

Hi,

...and another issue I'm working on right now. 馃槉

Currently I'm using a hack to support XInclude in my source files. By adding this templates:

<sch:let name="include" value="false()"/>

<xsl:template match="/" priority="100000000">
    <xsl:param name="xi:xinclude" select="$include" tunnel="yes"/>
    <xsl:variable name="xi:xincluded">
        <xsl:apply-templates select="." mode="xi:xinclude"/>
    </xsl:variable>
    <xsl:choose>
        <xsl:when test="not($xi:xinclude)">
            <xsl:next-match/>
        </xsl:when>
        <xsl:otherwise>
            <xsl:apply-templates select="$xi:xincluded">
                <xsl:with-param name="xi:xinclude" select="false()" tunnel="yes"/>
            </xsl:apply-templates>
        </xsl:otherwise>
    </xsl:choose>
</xsl:template>

<xsl:template match="xi:include[not(@parse = 'text')]" mode="xi:xinclude" priority="100000000">
    <xsl:apply-templates select="doc(resolve-uri(@href, base-uri(.)))/*" mode="#current"/>
</xsl:template>

<!-- 
    copies all nodes:
-->
<xsl:template match="node() | @*" mode="xi:xinclude">
    <xsl:copy>
        <xsl:apply-templates select="@*" mode="#current"/>
        <xsl:apply-templates select="node()" mode="#current"/>
    </xsl:copy>
</xsl:template>

it works at least with the Schematron engine (in ant). But it is a hack and will lead maybe to other issues.

It would be much cleaner if I just could pass a Saxon config file to activate the XInclude support of the Saxon. But as far as I can see there is no such option here, is there?

Thanks!

@phax phax self-assigned this Aug 7, 2019
@phax phax added the pinned label Nov 4, 2019
phax added a commit that referenced this issue Dec 4, 2020
@phax
Copy link
Owner

phax commented Dec 4, 2020

As I am using JAXP to instantiate Saxon ( TransformerFactory.newInstance (SAXON_TRANSFORMER_FACTORY_CLASS, aEffectiveClassLoader);) I don't know how to pass a configuration file.
Instead I enabled XInclude by default now. Does that help (better late than never ;-) ) - would be part of 6.0.2

@phax phax added Saxon and removed ANT task labels Dec 4, 2020
@phax phax closed this as completed Dec 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants