XTRAN treats XML as a computer language, in which each "statement" is a tag, a line or segment of nonmarkup text, or an end tag.
The following is an English paraphrase of the XTRAN rules used for this example. These rules comprise 91 (net) lines of XTRAN's rules language.
For each XML "statement"
If nonmarkup text line or segment
For each entity reference in text
Tally entity reference occurrence by name
Record source file and line of this occurrence
Sort entity names
For each entity name seen, alphabetically
Report entity name with tally
For each occurrence of this entity name
Report occurrence source file and line
<tag1><tag2/><tag3 att1="att1v" att2="att2v"> This is a line of text, & is followed by a comment.<!-- comment 1 --> This is the second line of text, &003; with no comment. </tag3> <!-- comment 2 --> This is the third line of text, & is preceded by a comment. <tag3>Some text &003; in a "tag3".</tag3> <tag4 attb="attbv1" atta/> This is more nonmarkup &003; text.<tag4 attb="attbv2"/> </tag1>
Running the rules shown above on the XML input shown above generated the following XTRAN analysis output:
XML Entity Reference Usage
&003; 3
sample.xml(3)
sample.xml(7)
sample.xml(9)
& 2
sample.xml(2)
sample.xml(5)
COPYRIGHT 2008; reproduction prohibited without permission. Revised 2006-11-27
XTRAN is a trademark of Pennington Systems Incorporated.
Pennington Systems Incorporated
8655 East
Via de Ventura, Suite G200
Scottsdale, Arizona 85258-3321
Phone: +1(480)626-5503
Fax: +1(480)626-7618
Email: Info@Pennington.com
Web: http://WWW.Pennington.com