[oXygen-user] Can custom XML Refactoring operation resolve XIncludes via doc()?
Radu Pisoi
radu_pisoi at sync.ro
Thu Mar 2 09:14:03 CST 2017
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" match="xi:include[@href]"
> mode="expand-xi">
> <xsl:variable name="externalDoc" select="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
> oXygen-user at oxygenxml.com
> https://www.oxygenxml.com/mailman/listinfo/oxygen-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.oxygenxml.com/pipermail/oxygen-user/attachments/20170302/35c66bc3/attachment.html>
More information about the oXygen-user
mailing list