T
Tristan Miller
Greetings.
I have an XML file listing various information about text glyphs (Unicode
value, HTML entity name, SGML entity name, etc.). All glyphs have a
Unicode value, but not all of them have HTML or SGML entity names.
I want to print out a list of these glyphs, using the HTML entity name if
it is available; otherwise the Unicode value should be printed. The
trouble is that I don't know how I can print only one or the other.
Each glyph is represented by an element <char>. Inside is a set of 0 or
more <entity> elements with "set" attributes. If a glyph has an HTML
entity, then it will contain an <entity> with the "set" attribute
beginning with the characters "html". All <char> elements also contain
the Unicode value in the enclosed <unicode> element.
For example, I want the output of the following XML file to be as follows:
bar
2004
fred
2006
Can anyone help?
<char>
<entity name="foo" set="iso-8879-pub">...</entity>
<entity name="bar" set="html4-special">...</entity>
<unicode value="2003">...</unicode>
</char>
<char>
<entity name="baz" set="iso-8879-pub">...</entity>
<unicode value="2004">...</unicode>
</char>
<char>
<entity name="fred" set="html4-alpha">...</entity>
<entity name="quux" set="iso-8879-pub">...</entity>
<unicode value="2005">...</unicode>
</char>
<char>
<unicode value="2006">...</unicode>
</char>
Kind regards,
Tristan
I have an XML file listing various information about text glyphs (Unicode
value, HTML entity name, SGML entity name, etc.). All glyphs have a
Unicode value, but not all of them have HTML or SGML entity names.
I want to print out a list of these glyphs, using the HTML entity name if
it is available; otherwise the Unicode value should be printed. The
trouble is that I don't know how I can print only one or the other.
Each glyph is represented by an element <char>. Inside is a set of 0 or
more <entity> elements with "set" attributes. If a glyph has an HTML
entity, then it will contain an <entity> with the "set" attribute
beginning with the characters "html". All <char> elements also contain
the Unicode value in the enclosed <unicode> element.
For example, I want the output of the following XML file to be as follows:
bar
2004
fred
2006
Can anyone help?
<char>
<entity name="foo" set="iso-8879-pub">...</entity>
<entity name="bar" set="html4-special">...</entity>
<unicode value="2003">...</unicode>
</char>
<char>
<entity name="baz" set="iso-8879-pub">...</entity>
<unicode value="2004">...</unicode>
</char>
<char>
<entity name="fred" set="html4-alpha">...</entity>
<entity name="quux" set="iso-8879-pub">...</entity>
<unicode value="2005">...</unicode>
</char>
<char>
<unicode value="2006">...</unicode>
</char>
Kind regards,
Tristan