Dever, Paul (ELS | 6 Oct 2006 21:22
Picon

using automatic character conversion in XML to XML transformation

If I transform my XML document to HTML using the HTML output method oXygen automatically turns special characters into HTML character entities (e.g., a copyright symbol gets transformed into "©"). 
 
I want to use that functionality in a transformation from XML to XML using XML as an output method, but I can't figure out how to do it.  Is there a way?
 
Thanks,
--Paul
___________________________
Paul Dever :: Manager, Electronic Workflows :: EPD-US
11830 Westline Industrial Drive, St. Louis, MO 63146
ELSEVIER
 
 
 
 
 
_______________________________________________
oXygen-user mailing list
oXygen-user@...
http://www.oxygenxml.com/mailman/listinfo/oxygen-user
Miller, Ray (Centech | 7 Oct 2006 20:59
Favicon

Macro to Strip Tags from DocBook Olink target.db File

docbook-rng-5.0b8 xsl-1.71.0 saxon-6.5.5 oxygen-7.2.0 (eclipse-3.2 plugin)

 

When generating an olink target data file (targetdb.xml), tags <i> and </i> surround each chapter’s element text. Would like a macro to strip the aforementioned tags from targetdb.xml subsequent to pre-processing but prior to transformations, executing automatically each time a transformation is run on the project AND the stringparm collect.xref.targets is set to ‘yes’ or ‘only’. Currently performing this activity utilizing find/replace (ugh).

 

I believe a site-published solution (under Documentation/Articles) addressing the removal of unwanted tags and characters (along with the macro) from a DocBook target.db document will be of interest to other oXygen/DocBook users.

 

Advise and comments please.

 

Ray

_______________________________________________
oXygen-user mailing list
oXygen-user@...
http://www.oxygenxml.com/mailman/listinfo/oxygen-user
George Cristian Bina | 9 Oct 2006 09:30
Favicon
Gravatar

Re: using automatic character conversion in XML to XML transformation

Hi Paul,

When the output method is html then the XSLT processor uses a different 
output serializer than the one used when you set the output method to 
xml. For XML there are different rules than the ones for HTML.

In XSLT 1.0 you can set the output encoding to ASCII for instance or to 
some encoding that cannot represent the characters you want to output as 
entities and those characters will be output as as character references, 
the copyright symbol will appear as &_#169; (added one underscore _ to 
avoid the conversion of the character reference to the actual character 
by some email clients).

In XSLT 2.0 you can use character maps to output &_copy; (again I added 
an _ ). You can find below a sample stylesheet that copies the source to 
the output representing the copyright characters as &_copy;

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="2.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:character-map name="test">
         <xsl:output-character character="©" string="&amp;copy;"/>
     </xsl:character-map>
     <xsl:output use-character-maps="test"/>
     <xsl:template match="node() |  <at> *">
         <xsl:copy>
             <xsl:apply-templates select="node() |  <at> *"/>
         </xsl:copy>
     </xsl:template>
</xsl:stylesheet>

This stylesheet applied on a document like:

<test>
     <a> © </a>
     <b> © </b>
     <c> © </c>
</test>

will result in
<?xml version="1.0" encoding="UTF-8"?><test>
     <a> &copy; </a>
     <b> &copy; </b>
     <c> &copy; </c>
</test>

But note that the result document is not wellformed as the copy entity 
is used but not declared. To have an wellformed result you need to 
create a DTD like below

test.dtd
<?xml version="1.0" encoding="UTF-8"?>
<!ENTITY copy "©">

and change the xsl:output to refer to this DTD

<xsl:output doctype-system="test.dtd" use-character-maps="test"/>

And the result will be now:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE test
   SYSTEM "test.dtd">
<test>
     <a> &copy; </a>
     <b> &copy; </b>
     <c> &copy; </c>
</test>

which is wellformed (but not valid against the DTD). If you want the 
output to be also valid you need to update the DTD to contain the 
elements and attributes declarations, in the above example that will be

<?xml version="1.0" encoding="UTF-8"?>
<!ENTITY copy "©">
<!ELEMENT test (a,b,c)>
<!ELEMENT a (#PCDATA)>
<!ELEMENT b (#PCDATA)>
<!ELEMENT c (#PCDATA)>

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Dever, Paul (ELS) wrote:
> If I transform my XML document to HTML using the HTML output method 
> oXygen automatically turns special characters into HTML character 
> entities (e.g., a copyright symbol gets transformed into "&copy;"). 
>  
> I want to use that functionality in a transformation from XML to XML 
> using XML as an output method, but I can't figure out how to do it.  Is 
> there a way?
>  
> Thanks,
> --Paul
> ___________________________
> *Paul Dever* *::* Manager, Electronic Workflows *::* EPD-US
> (T) +1 314-995-3291 *:: *(E) p.dever@... 
> <mailto:p.dever@...> 
> 11830 Westline Industrial Drive, St. Louis, MO 63146
> *ELSEVIER*
> ** 
> ** 
>  
>  
>  
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> oXygen-user mailing list
> oXygen-user@...
> http://www.oxygenxml.com/mailman/listinfo/oxygen-user
Sorin Ristache | 9 Oct 2006 17:07
Favicon

Re: Macro to Strip Tags from DocBook Olink target.db File

Hello Ray,

I think the effect of surrounding the chapter title in an "i" element in 
the olink target file is intended, not a side effect as you can see in 
the template which generates it:

   <xsl:template match="chapter|appendix" mode="insert.title.markup">
       <xsl:param name="purpose"/>
       <xsl:param name="xrefstyle"/>
       <xsl:param name="title"/>

       <xsl:choose>
           <xsl:when test="$purpose = 'xref'">
               <i>
                   <xsl:copy-of select="$title"/>
               </i>
           </xsl:when>
           <xsl:otherwise>
               <xsl:copy-of select="$title"/>
           </xsl:otherwise>
       </xsl:choose>
   </xsl:template>

You can remove the <i> and </i> tags in a customization layer of the 
main DocBook stytlesheet which duplicates this template and modifies it 
by removing these tags. Apply the customization layer instead of the 
main DocBook stylesheet to remove the tags prior to transformations and 
perform the transformations at the same time (if collect.xref.targets is 
set to 'yes').

We will consider publishing this customization on the <oXygen/> website.

Best regards,
Sorin

http://www.oxygenxml.com/

Miller, Ray (Centech) wrote:
> docbook-rng-5.0b8 xsl-1.71.0 saxon-6.5.5 oxygen-7.2.0 (eclipse-3.2 plugin)
> 
>  
> 
> When generating an olink target data file (targetdb.xml), tags <i> and 
> </i> surround each chapter’s element text. Would like a macro to strip 
> the aforementioned tags from targetdb.xml subsequent to pre-processing 
> but prior to transformations, executing automatically each time a 
> transformation is run on the project AND the stringparm 
> collect.xref.targets is set to ‘yes’ or ‘only’. Currently performing 
> this activity utilizing find/replace (ugh).
> 
>  
> 
> I believe a site-published solution (under Documentation/Articles) 
> addressing the removal of unwanted tags and characters (along with the 
> macro) from a DocBook target.db document will be of interest to other 
> oXygen/DocBook users.
> 
>  
> 
> Advise and comments please.
> 
>  
> 
> Ray
Miller, Ray (Centech | 9 Oct 2006 17:42
Favicon

RE: Macro to Strip Tags from DocBook Olink target.dbFile

>> I think the effect of surrounding the chapter title in an "i" element
in 
the olink target file is intended, not a side effect as you can see in 
the template which generates it:

   <xsl:template match="chapter|appendix" mode="insert.title.markup">
       <xsl:param name="purpose"/>
       <xsl:param name="xrefstyle"/>
       <xsl:param name="title"/>

       <xsl:choose>
           <xsl:when test="$purpose = 'xref'">
               <i>
                   <xsl:copy-of select="$title"/>
               </i>
           </xsl:when>
           <xsl:otherwise>
               <xsl:copy-of select="$title"/>
           </xsl:otherwise>
       </xsl:choose>
   </xsl:template>

You can remove the <i> and </i> tags in a customization layer of the 
main DocBook stytlesheet which duplicates this template and modifies it 
by removing these tags. Apply the customization layer instead of the 
main DocBook stylesheet to remove the tags prior to transformations and 
perform the transformations at the same time (if collect.xref.targets is

set to 'yes').<<

I see that now. But the target database file will not validate against
targetdatabase.dtd with the <i> tags. Is this a developer oversight or
an error in my usage?

Ray
Allison Bloodworth | 9 Oct 2006 18:28
Picon
Favicon

XML Schema validation broken in 7.2?

Hi, 

Last week I upgraded (I think from Oxygen 7.1) to Oxygen 7.2 which is using
Xerces 2.8.0 for schema validation. Suddenly XML instance documents that are
definitely not valid are being called valid by Oxygen. I am using the red
"checkmark" button for which the tool tip is "Validate Document". I am
creating the files by opening a new document in Oxygen and attaching a
schema that way. Documents with no content in the elements as well as
documents that are just completely wrong are coming up as valid. When I
validate using Xerces at the command line (java sax.Counter) I am getting
the proper errors for these same documents. Additionally, I am getting the
proper errors in Oxygen when I try to validate the schema itself. What could
be going wrong?

Allison Bloodworth
Principal Administrative Analyst
Technology Program Office
University of California, Berkeley
(415) 377-8243
abloodworth@...
Sorin Ristache | 10 Oct 2006 08:43
Favicon

Re: Macro to Strip Tags from DocBook Olink target.dbFile

Hello,

I think you will have to ask the DocBook developers about that. Anyway 
the chapter title printed with italic characters is a way to make it 
more visible and it does not seem wrong or strange.

Best regards,
Sorin

Miller, Ray (Centech) wrote:
> I see that now. But the target database file will not validate against
> targetdatabase.dtd with the <i> tags. Is this a developer oversight or
> an error in my usage?
> 
> Ray
George Cristian Bina | 10 Oct 2006 08:58
Favicon
Gravatar

Re: XML Schema validation broken in 7.2?

Dear Allison,

Please try to put together a small sample (XML+schema) to show that 
problem and send that over as I do not remember a similar report against 
oXygen 7.2.

A couple of things you should try:
- Use also the "Reset Cache and Validate" action (at the left of the 
validate action in the toolbar) and see if you get different results
- Make sure you have the Options->Preferences -- XML -- XML Parser -- 
http://apache.org/xml/features/validation/schema-full-checking enabled 
(if that is disabled then type derivations and unique particle 
attribution errors are not checked).
- Make sure you have the schema that oXygen reports errors on as the 
schema associated for with those documents, for that use the "Open 
External Schema" action (also from the toolbar) to open the associated 
schema and validate that schema.

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Allison Bloodworth wrote:
> Hi, 
> 
> Last week I upgraded (I think from Oxygen 7.1) to Oxygen 7.2 which is using
> Xerces 2.8.0 for schema validation. Suddenly XML instance documents that are
> definitely not valid are being called valid by Oxygen. I am using the red
> "checkmark" button for which the tool tip is "Validate Document". I am
> creating the files by opening a new document in Oxygen and attaching a
> schema that way. Documents with no content in the elements as well as
> documents that are just completely wrong are coming up as valid. When I
> validate using Xerces at the command line (java sax.Counter) I am getting
> the proper errors for these same documents. Additionally, I am getting the
> proper errors in Oxygen when I try to validate the schema itself. What could
> be going wrong?
> 
> Allison Bloodworth
> Principal Administrative Analyst
> Technology Program Office
> University of California, Berkeley
> (415) 377-8243
> abloodworth@...
> 
> 
> 
> _______________________________________________
> oXygen-user mailing list
> oXygen-user@...
> http://www.oxygenxml.com/mailman/listinfo/oxygen-user
Thomas Zastrow | 10 Oct 2006 12:01
Picon

Problem with Oxygen on Kubuntu Dapper Dake

Hi there,

I can't install Oxygen 7.2 on Kubuntu Dapper Dake. There is a 
Java-installation and the variables JAVA_HOME and JAVA are pointing to 
it. After starting oxygen.sh I get the error:

zastrow <at> schleppi:~/downloads/progs$ ./oxygen.sh
Starting Installer ...
java.lang.NoClassDefFoundError: javax.swing.JOptionPane
   at java.lang.Class.initializeClass(libgcj.so.7)
   at com.install4j.runtime.installer.Installer.reportExeption(Unknown 
Source)
   at com.install4j.runtime.installer.Installer.main(Unknown Source)
   at java.lang.reflect.Method.invoke(libgcj.so.7)
   at com.exe4j.runtime.LauncherEngine.launch(Unknown Source)
   at com.install4j.runtime.Launcher.main(Unknown Source)

Best,

Tom

--

-- 
Thomas Zastrow
Seminar fuer Sprachwissenschaft
Universitaet Tuebingen

http://www.sfs.uni-tuebingen.de/dialectometry/

Wilhelm Str. 19

D-72074 Tübingen

Tel.: 07071/29-73968
Fax: 07071/29-5214
Sorin Ristache | 10 Oct 2006 12:15
Favicon

Re: Problem with Oxygen on Kubuntu Dapper Dake

Hello,

The Linux install kit is an Install4j application. As you can see from 
the stack trace the installer does not find the core Java class library 
(java.swing.*) of the Java virtual machine. I think your JVM 
installation is corrupt. Can you run a graphical Java application with 
that JVM ?

Also please run the installer with a JVM from Sun Microsystems. The GNU 
libgcj Java virtual machine (which includes the libgcj.so library) 
cannot run <oXygen/> because it does not provide a standard encryption 
algorithm used to verify the license key. This was discussed also on the 
<oXygen/> forum where the supported and unsupported JVMs were discussed 
recently:

http://www.oxygenxml.com/forum/ftopic1887.html

Regards,
Sorin

Thomas Zastrow wrote:
> Hi there,
> 
> I can't install Oxygen 7.2 on Kubuntu Dapper Dake. There is a 
> Java-installation and the variables JAVA_HOME and JAVA are pointing to 
> it. After starting oxygen.sh I get the error:
> 
> 
> zastrow <at> schleppi:~/downloads/progs$ ./oxygen.sh
> Starting Installer ...
> java.lang.NoClassDefFoundError: javax.swing.JOptionPane
>   at java.lang.Class.initializeClass(libgcj.so.7)
>   at com.install4j.runtime.installer.Installer.reportExeption(Unknown 
> Source)
>   at com.install4j.runtime.installer.Installer.main(Unknown Source)
>   at java.lang.reflect.Method.invoke(libgcj.so.7)
>   at com.exe4j.runtime.LauncherEngine.launch(Unknown Source)
>   at com.install4j.runtime.Launcher.main(Unknown Source)
> 
> 
> Best,
> 
> Tom

Gmane