Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old December 4th, 2006, 05:25 PM
Jean-François Michaud
Guest
 
Posts: n/a
Default XML to SGML entities

Hello,

I was wondering if anybody could point me in the right direction
regarding this.

I have unicode entities in an XML in hexadecimal format and I need to
be able to convert to ISO entities. Are there facilities available to
do this easily or do I have to parse all text and convert everything
manually? If thats what I have to do, is there any code already
available that would orient me in the right direction?

This is my XML snippet.

XML:

<?xml version = "1.0" encoding = "UTF-8"?>
<root>
<para>&#x212B; &#x00C5; &#x00E5; &#x00C3; &#x03B2; &#x03B5; &#x03F0;
&#x03BB; &#x03BC;</para>
</root>

I basically need to something like this:

SGML:

<root>
<para>&angst; &Aring; &aring; &Atilde; &b.beta; &b.epsi; &b.kappav;
&b.lambda; &b.mu;</para>
</root>

Thanks

Regards
Jeff

  #2  
Old December 4th, 2006, 08:25 PM
David Carlisle
Guest
 
Posts: n/a
Default Re: XML to SGML entities

Jean-François Michaud wrote:
Quote:
Hello,
>
I was wondering if anybody could point me in the right direction
regarding this.
>
I have unicode entities in an XML in hexadecimal format and I need to
be able to convert to ISO entities. Are there facilities available to
do this easily or do I have to parse all text and convert everything
manually? If thats what I have to do, is there any code already
available that would orient me in the right direction?
>
This is my XML snippet.
>
XML:
>
<?xml version = "1.0" encoding = "UTF-8"?>
<root>
<para>&#x212B; &#x00C5; &#x00E5; &#x00C3; &#x03B2; &#x03B5; &#x03F0;
&#x03BB; &#x03BC;</para>
</root>
>
I basically need to something like this:
>
SGML:
>
<root>
<para>&angst; &Aring; &aring; &Atilde; &b.beta; &b.epsi; &b.kappav;
&b.lambda; &b.mu;</para>
</root>
>
Thanks
>
Regards
Jeff
>

one way is to use xslt2 character maps, if I save your file as ent.xml,
saxon8 gives the following output if run with the stylesheet at the end
it's not quite the result you asked for but I think the bold greek
should map to the characters in plane1 so the grk3 entity names are used
rather than grk4. (It would be easy for you to take a local copy and
change that though)

David

$ saxon8 ent.xml ent.xsl
<?xml version="1.0" encoding="UTF-8"?><root>
<para>&angst; &Aring; &aring; &Atilde; &beta; &epsiv; &kappav;
&lambda; &mu;</para>
</root>



<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:import
href="http://www.w3.org/2003/entities/iso9573-2003/iso9573-2003map.xsl"/>
<xsl:output use-character-maps="iso9573-2003"/>
<xsl:template match="/">
<xsl:copy-of select="/"/>
</xsl:template>

</xsl:stylesheet>


  #3  
Old December 5th, 2006, 08:15 PM
Jean-François Michaud
Guest
 
Posts: n/a
Default Re: XML to SGML entities


David Carlisle wrote:
Quote:
Jean-François Michaud wrote:
Quote:
Hello,

I was wondering if anybody could point me in the right direction
regarding this.

I have unicode entities in an XML in hexadecimal format and I need to
be able to convert to ISO entities. Are there facilities available to
do this easily or do I have to parse all text and convert everything
manually? If thats what I have to do, is there any code already
available that would orient me in the right direction?

This is my XML snippet.

XML:

<?xml version = "1.0" encoding = "UTF-8"?>
<root>
<para>&#x212B; &#x00C5; &#x00E5; &#x00C3; &#x03B2; &#x03B5; &#x03F0;
&#x03BB; &#x03BC;</para>
</root>

I basically need to something like this:

SGML:

<root>
<para>&angst; &Aring; &aring; &Atilde; &b.beta; &b.epsi; &b.kappav;
&b.lambda; &b.mu;</para>
</root>

Thanks

Regards
Jeff
>
>
one way is to use xslt2 character maps, if I save your file as ent.xml,
saxon8 gives the following output if run with the stylesheet at the end
it's not quite the result you asked for but I think the bold greek
should map to the characters in plane1 so the grk3 entity names are used
rather than grk4. (It would be easy for you to take a local copy and
change that though)
>
David
>
$ saxon8 ent.xml ent.xsl
<?xml version="1.0" encoding="UTF-8"?><root>
<para>&angst; &Aring; &aring; &Atilde; &beta; &epsiv; &kappav;
&lambda; &mu;</para>
</root>
>
>
>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>
<xsl:import
href="http://www.w3.org/2003/entities/iso9573-2003/iso9573-2003map.xsl"/>
<xsl:output use-character-maps="iso9573-2003"/>
<xsl:template match="/">
<xsl:copy-of select="/"/>
</xsl:template>
>
</xsl:stylesheet>
Wow! More than I could ever ask for. This is exactly the kind of stuff
I was looking for. Thank you much for your help!! I will look into this
more closely.

Warm regards
Jean-Francois Michaud

 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles