Question related to conversion of text entities in XML

As per the documentation XPP cannot interpret text or file entities and one needs to use a transformation tool to convert the text entity before importing the instance into the XPP division. Which transformation tool can be used for achieving such a conversion ?

  • There are a number of possible transformation tools that are part of XPP that you could use.

    I suggest you read Chapter 3 of the latest version of the XPP Transforming Data manual.

    Here's a part of the beginning of that chapter (text in brackets added here by me):

    With XyChange, you can transform text to a format appropriate for your needs. You can also choose the tool appropriate for your task. XyChange can be used to launch Perl or OmniMark scripts, or XSLT style sheets. Each transformation technology has its strengths and weaknesses:

    • XyChange [i.e. using classic XPP tt specs] offers fast pattern matching.
    • Perl offers strong string processing capability, ways to work with XML structure, and strong UTF-8 support.
    • OmniMark offers the ability to program using the structure of an SGML or XML instance.
    • XSLT [XSLT 1 or XSLT 2] gives you a standard way to work with XML, transforming it as required.

    Jonathan Dagresta
    RWS Group/
    XPP Development

  • A very simple XSLT V2 stylesheet should do the trick.

    When you run an XSLT stylesheet the XSLT engine will include and expand all the entities provided that it can parse the incoming instance.

    So you will need to either setup your catalog.xml file correctly.

    Note that you will be forced to use the XSLT V2 engine as the catalog.xml file is not supported by the V1 engine that comes with XPP.

    Note also that if you use system declarations that point to the correct files on your XPP system, you could still get away with the XSLT V1 engine.

    Here is a sample V2 stylesheet that will expand both internal and external entities but otherwise does nothing else (but the normal things an XSLT engine does - but that would lead us too far to go into that):

    <xsl:stylesheet version="2.0" xmlns:xsl="www.w3.org/.../Transform" >
    <xsl:output method="xml" version="1.0" />
    <!-- keep all nodes -->
    <xsl:template match="node()">
    <xsl:copy>
    <xsl:copy-of select="@*"/>
    <xsl:apply-templates/>
    </xsl:copy>
    </xsl:template>

    </xsl:stylesheet>