Parsing address data from PAR and BREAK
Posted: Tue Jan 27, 2009 12:33 am
Greetings,
I'm relatively new to XSLT. I need to extract legacy data from an XML representation of rich-text, and am having difficulty parsing around the <break> element. Specifically, I'm trying to reliably parse address information from this:
...
<tablecell borderwidth='0px'>
<par def='23'><run><font size='9pt' name='Arial'
truetype='false' familyid='10'/>
123 E. Main Street<break/>Anytown, ST 12355<break/>USA</run>
<run><font size='9pt' style='bold' name='Arial' truetype='false'
familyid='10' color='navy'/>
</run>
</par>
</tablecell>
...
...to this:
<address>123 E. Main Street</address>
<city>Anytown</city>
<state>ST</state>
<zipcode>12355</zipcode>
<country>USA</country>
I'm using an XSLT 2.0 engine. I've been poking around trying to find how this might be done, but am coming up short. Any suggestions will be much appreciated.
Thanks,
Karl Forsyth
I'm relatively new to XSLT. I need to extract legacy data from an XML representation of rich-text, and am having difficulty parsing around the <break> element. Specifically, I'm trying to reliably parse address information from this:
...
<tablecell borderwidth='0px'>
<par def='23'><run><font size='9pt' name='Arial'
truetype='false' familyid='10'/>
123 E. Main Street<break/>Anytown, ST 12355<break/>USA</run>
<run><font size='9pt' style='bold' name='Arial' truetype='false'
familyid='10' color='navy'/>
</run>
</par>
</tablecell>
...
...to this:
<address>123 E. Main Street</address>
<city>Anytown</city>
<state>ST</state>
<zipcode>12355</zipcode>
<country>USA</country>
I'm using an XSLT 2.0 engine. I've been poking around trying to find how this might be done, but am coming up short. Any suggestions will be much appreciated.
Thanks,
Karl Forsyth