Radu,

Thanks for the information and suggestion. I see what you mean, and your idea 
worked in my situation.

Best regards,
Amanda

From: oXygen-user [mailto:[email protected]] On Behalf Of Radu 
Pisoi
Sent: Thursday, March 02, 2017 10:14 AM
To: [email protected]
Subject: Re: [oXygen-user] Can custom XML Refactoring operation resolve 
XIncludes via doc()?

Hi,

Unfortunately there is no out of the box setting that can activate the XInclude 
expansion for the documents loaded with the doc function.

As a simple workaround, you can use the following XSLT snippet to recursively 
expand the XInclude nodes:

<xsl:template match="/">

    <!--  ... -->

    <xsl:variable name="tsDoc" select="doc('path/to/targetset')"/>

    <xsl:variable name="expandedTS" >

        <xsl:apply-templates select="$tsDoc" mode="expand-xi"/>

    </xsl:variable>



    <!--  Continue processing with XInclude expanded... -->



</xsl:template>





<!-- Expand xi:include nodes -->

<xsl:template 
xmlns:xi="http://www.w3.org/2001/XInclude";<http://www.w3.org/2001/XInclude> 
match="xi:include[@href]" mode="expand-xi">

    <xsl:variable name="externalDoc" select="doc(resolve-uri(@href, 
base-uri(.)))"<mailto:doc(resolve-uri(@href,base-uri(.)))>/>

    <xsl:apply-templates select="$externalDoc" mode="expand-xi"/>

</xsl:template>



<!-- Copy template -->

<xsl:template match="node() | @*" mode="expand-xi">

    <xsl:copy>

        <xsl:apply-templates select="node() | @*" mode="expand-xi"/>

    </xsl:copy>

</xsl:template>


--

Regards,

Radu

--

Radu Pisoi

<oXygen/>  XML Editor, Schema Editor and XSLT Editor/Debugger

http://www.oxygenxml.com


On 2/27/2017 7:33 PM, Amanda Galtman wrote:
Hi,

I see from the following doc page that custom XML Refactoring operations 
disable the XInclude mechanism.
https://oxygenxml.com/doc/versions/18.1/ug-editor/topics/custom-refactoring-operations-x-tools.html

I understand the purpose of “safe mode” for the file that the refactoring 
operation is modifying. In my case, my refactoring operation needs to retrieve 
data from an auxiliary XML file using doc(). The other XML file is a DocBook 
targetset file. Read-only access to the targetset file is good enough, but I 
really need to get inside the subordinate XInclude files. Is this possible in 
the context of a custom XML Refactoring XSLT operation?

Thanks,
Amanda




_______________________________________________

oXygen-user mailing list

[email protected]<mailto:[email protected]>

https://www.oxygenxml.com/mailman/listinfo/oxygen-user

_______________________________________________
oXygen-user mailing list
[email protected]
https://www.oxygenxml.com/mailman/listinfo/oxygen-user

Reply via email to