[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Preserving Graphic Entities

Subject: Re: Preserving Graphic Entities
From: "Lizzi, Vincent vincent.lizzi@xxxxxxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 13 Jul 2022 22:54:07 -0000
Re:  Preserving Graphic Entities
Hi Rick,

The DOCTYPE is usually removed during parsing of the XML, but it is possible
to work around that and get access to the DOCTYPE. This might do what you are
asking:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="3.0">

    <xsl:output omit-xml-declaration="yes"/>

    <xsl:mode on-no-match="shallow-copy"/>

    <xsl:template match="/Document">
        <xsl:variable name="unparsed" select="unparsed-text(base-uri())"/>
        <xsl:variable name="start" select="substring-before($unparsed,
'&lt;Document')"/>
        <xsl:value-of select="$start" disable-output-escaping="yes"/>
        <xsl:next-match/>
    </xsl:template>

</xsl:stylesheet>


This essentially reads the XML (assuming the XML is in a file) as plain text
and outputs a copy of everything that appears before the root element, then
does an identity transform. The matching in substring-before is fragile
because the root element <Document not be the first thing in the file that
matches this sequence of characters, so you might need to adjust the matching.
Depending on your needs you could make a specific match that works for your
documents. If you need a generalized approach that works for any XML document
it would need to follow the rules of the grammar defined in the W3C XML
Recommendation.

Kind regards,
Vincent

_____________________________________________
Vincent M. Lizzi
Head of Information Standards | Taylor & Francis Group
vincent.lizzi@xxxxxxxxxxxxxxxxxxxx<mailto:vincent.lizzi@xxxxxxxxxxxxxxxxxxxx>



Information Classification: General
From: rick@xxxxxxxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Wednesday, July 13, 2022 4:16 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  Preserving Graphic Entities

Hello All,

I am sorry if this is an old question, but when I export to XML, I am getting
graphic entities. I need to preserve these when I transform the file with XSLT
3. Is there a built-in way to do this or some kind of realistic hack? Below is
a sample before transformation. Thank you very much.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Document SYSTEM
"file:///C:/Users/rick/AppData/Roaming/Adobe/FrameMaker/16/Orion-graphics/Gra
phics.dtd" [

<!NOTATION jpeg    PUBLIC "">
<!ENTITY abc123 SYSTEM "3753.jpeg" NDATA jpeg>
<!ENTITY SingleImportedImage1 SYSTEM "11721.jpeg" NDATA jpeg>
]>

<Document>
    <Paragraph>Sample for testing graphics export to XML.</Paragraph>
    <Paragraph>Single imported image:</Paragraph>
    <Graphic boardno="abc123" reprowid="2.567in" reprodep="3.367in"/>
    <Paragraph>Single imported image:</Paragraph>
   <Graphic boardno="SingleImportedImage1" reprowid="2.567in"
reprodep="3.367in"/>
</Document>

Rick
XSL-List info and archive<http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe<http://lists.mulberrytech.com/unsub/xsl-list/194671> (by
email<>)

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.