Transforming without Entity placeholders

Hello list, i have some XML files from a DocBook handbook project. The files are chunked into different chapter files. Now i would like to transform each chapter file that it outputs the same docbook code but with solved entity solution. So the result should be a clean DocBook file without entity placeholders. Has anyone done this already? Greetings Sascha -- Yours sincerly Sascha Manns

Hello Sascha, Do you mean to replace the references to any entity declared in the DocBook 4 DTD or in the DOCTYPE declaration of the XML file, for example ä with the entity value, which is the ä character in this example? I think passing each DocBook XML chapter file through a simple XSLT copy transform will be enough to expand the entity references and replace them with the entity values. Did you try the copy.xsl stylesheet located in the following directory? OXYGEN_INSTALL_DIR\samples\xhtml\copy.xsl Best regards, Sorin <oXygen/> XML Editor http://www.oxygenxml.com Sascha Manns wrote:
Hello list,
i have some XML files from a DocBook handbook project. The files are chunked into different chapter files. Now i would like to transform each chapter file that it outputs the same docbook code but with solved entity solution. So the result should be a clean DocBook file without entity placeholders. Has anyone done this already?
Greetings Sascha

Hello Sorin, Am 19.11.2014 11:28, schrieb Oxygen XML Editor Support (Sorin Ristache):
Do you mean to replace the references to any entity declared in the DocBook 4 DTD or in the DOCTYPE declaration of the XML file, for example ä with the entity value, which is the ä character in this example? I think passing each DocBook XML chapter file through a simple XSLT copy transform will be enough to expand the entity references and replace them with the entity values. Did you try the copy.xsl stylesheet located in the following directory?
OXYGEN_INSTALL_DIR\samples\xhtml\copy.xsl In my present file i have anything like that:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd" [ <!ENTITY % entitiesxcom SYSTEM "entitiesxcom.ent"> %entitiesxcom; ]> <chapter id="cha.mychapter" lang="de" xml:base="cha-mychapter.xml"> <title>My Chapter</title> [...] </chapter> With using the copy.xsl it outputs: <?xml version="1.0" encoding="utf-8"?><chapter id="cha.mychapter" lang="de" xml:base="cha-mychapter.xml"> <title>My Chapter</title> </chapter> My goal ist anything like that: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd" [ <!ENTITY company "Acme Widgets, Inc."> <!ENTITY product "Top Widget"> ]> <chapter id="cha.mychapter" lang="de" xml:base="cha-mychapter.xml"> <title>My Chapter</title> [...] </chapter> Do you know what i mean? Greetings Sascha -- Yours sincerly Sascha Manns Bundesverband Deutscher Volks- und Betriebswirte FG Wirtschaftsinformatik & Informationsmanagement

Hello Sascha, Now I understand. You want to expand only the %entitiesxcom; reference in the DOCTYPE declaration. I suggest a find and replace operation on all DocBook chapter files using a regular expression that matches the entity reference. Unfortunately you can't do it in only one action in the Oxygen application because the replace part in the Find/Replace in Files dialog box (Ctrl+Shift+H) is not multi-line enabled yet. But you can do the replacement in one action per DocBook XML file, in the Find/Replace dialog box (Ctrl+F or menu Find -> FInd/Replace), using the following value in the "Find" area: <!ENTITY % entitiesxcom SYSTEM "entitiesxcom.ent">(\s*?)%entitiesxcom; and the following multi-line value in the "Replace with" area: <!ENTITY company "Acme Widgets, Inc."> <!ENTITY product "Top Widget"> You have to enable also the options "Regular expression" and "Dot matches all" in the Find/Replace dialog box. We will consider also adding multi-line support for the replace value in the Find/Replace in Files dialog box (Ctrl+Shift+H). Best regards, Sorin <oXygen/> XML Editor http://www.oxygenxml.com Sascha Manns wrote:
In my present file i have anything like that:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd" [ <!ENTITY % entitiesxcom SYSTEM "entitiesxcom.ent"> %entitiesxcom; ]> <chapter id="cha.mychapter" lang="de" xml:base="cha-mychapter.xml"> <title>My Chapter</title> [...] </chapter>
With using the copy.xsl it outputs: <?xml version="1.0" encoding="utf-8"?><chapter id="cha.mychapter" lang="de" xml:base="cha-mychapter.xml"> <title>My Chapter</title> </chapter>
My goal ist anything like that:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd" [ <!ENTITY company "Acme Widgets, Inc."> <!ENTITY product "Top Widget"> ]> <chapter id="cha.mychapter" lang="de" xml:base="cha-mychapter.xml"> <title>My Chapter</title> [...] </chapter>
Do you know what i mean?
Greetings Sascha
participants (2)
-
Oxygen XML Editor Support (Sorin Ristache)
-
Sascha Manns