Continue Multiple span text merged in single span - XSLT - xslt

How to continued multiple spanelement the S/B merged in single span element.
Input XML
<root>
<p>Paragraph <span>a</span><span>b</span><span>c</span><span>d</span> Under Continuing <span>Court</span> Jurisdiction</p>
<p>Paragraph <span>a</span><span>b</span><span>c</span><span>d</span> Under Continuing Court <span>Jurisdiction</span></p>
</root>
Expected Output
<root>
<p>Paragraph <span>abcd</span> Under Continuing <span>Court</span> Jurisdiction</p>
<p>Paragraph <span>abcd</span> Under Continuing Court <span>Jurisdiction</span></p>
</root>
XSLT Code
<xsl:copy>
<xsl:apply-templates select="#*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="span">
<xsl:copy>
<xsl:apply-templates/>
<xsl:for-each select="following-sibling::*[1][self::span]">
<xsl:value-of select="."/>
</xsl:for-each>
</xsl:copy>
</xsl:template>

The template for p elements should be along the lines of
<xsl:template match="p">
<xsl:copy>
<xsl:for-each-group select="node()" group-adjacent=". instance of element(span)">
<xsl:choose>
<xsl:when test="current-grouping-key()">
<span>
<xsl:apply-templates select="current-group()/node()"/>
</span>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="current-group()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each-group>
</xsl:copy>
</xsl:template>

Related

How to merged continued multiple elements in single element -XSLT

I have found continued multiple different elements (e.g. span, italic) in the p element. span continued elements merged in single element but how to handle continued multiple italic element.
Input XML
<root>
<p>Paragraph <span>a</span><span>b</span><span>c</span><span>d</span> Under Continuing <span>Court</span> Jurisdiction <italic>a</italic><italic>b</italic><italic>c</italic></p>
<p>Paragraph <italic>a</italic><italic>b</italic><italic>c</italic><italic>d</italic> Under Continuing Court <span>Jurisdiction</span></p>
</root>
XSLT Code
<xsl:template match="#*|node()">
<xsl:copy>
<xsl:apply-templates select="#*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="p">
<xsl:copy>
<xsl:for-each-group select="node()" group-adjacent=". instance of element(span), element(italic)">
<xsl:choose>
<xsl:when test="current-grouping-key()[1]">
<span>
<xsl:apply-templates select="current-group()/node()"/>
</span>
</xsl:when>
<xsl:when test="current-grouping-key()[2]">
<italic>
<xsl:apply-templates select="current-group()/node()"/>
</italic>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="current-group()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each-group>
</xsl:copy>
</xsl:template>
Expected Output
<root>
<p>Paragraph <span>abcd</span> Under Continuing <span>Court</span> Jurisdiction <italic>abc</italic></p>
<p>Paragraph <italic>abcd</italic> Under Continuing Court <span>Jurisdiction</span></p>
</root>
You can change your second template by using the local-name()s of the elements like this:
<xsl:template match="p">
<xsl:copy>
<xsl:for-each-group select="node()" group-adjacent="local-name()='span' or local-name()='italic'">
<xsl:choose>
<xsl:when test="current-grouping-key()">
<xsl:copy>
<xsl:apply-templates select="current-group()/node()"/>
</xsl:copy>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="current-group()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each-group>
</xsl:copy>
</xsl:template>
The output is
<root>
<p>
Paragraph <span>abcd</span>
Under Continuing <span>Court</span>
Jurisdiction <italic>abc</italic>
</p>
<p>
Paragraph <italic>abcd</italic>
Under Continuing Court <span>Jurisdiction</span>
</p>
</root>
The output may be formatted differently.

Need to perform two transformation for the same content in xsl

I have two different transformation.After first transformation get over second need to be applied but not able to do.I have referred other stackoverflow post but its not working for me.
Sample Input:
<Para>1<AAA>2<BBB>3</BBB>4</AAA>5</Para>
Requirement is like BBB may available outside of AAA as well.We need to remove all AAA and put the value in comma separated format.
Expected output after First:
<Para>12<BBB>3</BBB>45</Para>
Expected output on the Second:
<Para>12,3,45</Para>
First:
Here i am just removing tag AAA from the content.And retriving its content and child.
<xsl:template match="#*|node()">
<xsl:copy>
<xsl:apply-templates select="#*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match ="*/AAA">
<xsl:apply-templates/>
</xsl:template>
Second:
Here I am just appending comma between the node element by removing all the tags inside para and retrieving its content.
<xsl:param name="Para"></xsl:param>
<xsl:template match="Para">
<xsl:copy>
<xsl:variable name="BBB-element-exists">
<xsl:for-each select="node()[self::BBB ][normalize-space(.)!='']">
<xsl:if test="(self::Change and (child::BBB)) or (self::BBB)">
<xsl:value-of select="'BBBexists'"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:if test="$BBB-element-exists = 'BBBexists'">
<xsl:for-each select=".//text()">
<xsl:if test="position() >1 and not(parent::Change) ">
<xsl:value-of select="','" />
</xsl:if>
<xsl:value-of select="normalize-space()" />
</xsl:for-each>
</xsl:if>
<xsl:if test="$BBB-element-exists != 'BBBexists'">
<xsl:for-each select=".//text()">
<xsl:value-of select="normalize-space()" />
</xsl:for-each>
</xsl:if>
</xsl:copy>
</xsl:template>
<xsl:template match="#*|node()">
<xsl:copy>
<xsl:apply-templates select="#*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
You will need to use at least one mode to separate processing of the second step from the first:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template match="#*|node()" mode="#all">
<xsl:copy>
<xsl:apply-templates select="#*|node()" mode="#current"/>
</xsl:copy>
</xsl:template>
<xsl:template match="*/AAA">
<xsl:apply-templates/>
</xsl:template>
<xsl:variable name="first-pass">
<xsl:apply-templates select="node()"/>
</xsl:variable>
<xsl:template match="/">
<xsl:apply-templates select="$first-pass/node()" mode="step2"/>
</xsl:template>
<xsl:template match="Para" mode="step2">
<xsl:copy>
<xsl:variable name="BBB-element-exists">
<xsl:for-each select="node()[self::BBB ][normalize-space(.)!='']">
<xsl:if test="(self::Change and (child::BBB)) or (self::BBB)">
<xsl:value-of select="'BBBexists'"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:if test="$BBB-element-exists = 'BBBexists'">
<xsl:for-each select=".//text()">
<xsl:if test="position() >1 and not(parent::Change) ">
<xsl:value-of select="','" />
</xsl:if>
<xsl:value-of select="normalize-space()" />
</xsl:for-each>
</xsl:if>
<xsl:if test="$BBB-element-exists != 'BBBexists'">
<xsl:for-each select=".//text()">
<xsl:value-of select="normalize-space()" />
</xsl:for-each>
</xsl:if>
</xsl:copy>
</xsl:template>
</xsl:transform>

XSLT: how to insert tag 'mpadded' for second child of msup or msub

How to insert mpadded tag for the second child of msub|msup|msubsup elements. My coding is not working for nested child (msub|msup|msubsup) and I am getting the duplicate values also. Please suggest.
Input.xml
<root>
<disp-formula id="eqn2">
<label>2</label>
<math>
<msup>
<mrow>
<msub>
<mrow><mi>E</mi></mrow>
<mrow><mi>T</mi></mrow>
</msub>
</mrow>
<mrow><mn>2</mn></mrow>
</msup>
</math>
</disp-formula>
XSLT:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="#*|node()">
<xsl:copy>
<xsl:apply-templates select="#* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="msub|msup|msubsup">
<xsl:element name="{name()}">
<xsl:for-each select="child::*">
<xsl:choose>
<xsl:when test="position() eq 3">
<xsl:element name="mpadded">
<xsl:attribute name="voffset">
<xsl:choose>
<xsl:when test="parent::*[name() eq 'msubsup']"><xsl:text>-0.16ex</xsl:text></xsl:when>
</xsl:choose>
</xsl:attribute>
<xsl:copy-of select="."/>
</xsl:element>
</xsl:when>
<xsl:when test="position() eq 2">
<xsl:element name="mpadded">
<xsl:attribute name="voffset">
<xsl:choose>
<xsl:when test="parent::*[name() eq 'msub']"><xsl:text>0.3ex</xsl:text></xsl:when>
<xsl:when test="parent::*[name() eq 'msup']"><xsl:text>-0.4ex</xsl:text></xsl:when>
<xsl:when test="parent::*[name() eq 'msubsup']"><xsl:text>0.15ex</xsl:text></xsl:when>
</xsl:choose>
</xsl:attribute>
<xsl:copy-of select="."/>
</xsl:element>
</xsl:when>
<xsl:when test="position() eq 1">
<xsl:copy-of select="."/>
</xsl:when>
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:element>
<xsl:next-match/>
</xsl:template>
</xsl:stylesheet>
Required OutPut:
<root>
<disp-formula id="eqn2">
<label>2</label>
<math>
<msup>
<mrow>
<msub>
<mrow><mi>E</mi></mrow>
<mpadded voffset="0.3ex"><mrow><mi>T</mi></mrow></mpadded>
</msub>
</mrow>
<mpadded voffset="-0.4ex"><mrow><mn>2</mn></mrow></mpadded>
</msup>
</math>
</disp-formula>
Adding a template which gets applied for 2 child nodes of msub | msup | msubup
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="#*|node()">
<xsl:copy>
<xsl:apply-templates select="#* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="msub/*[count(preceding-sibling::*)=1]|msup/*[count(preceding-sibling::*)=1]|msubsup/*[count(preceding-sibling::*)=1]">
<mpadded>
<xsl:attribute name="voffset">
<xsl:choose>
<xsl:when test="parent::msub">0.3ex</xsl:when>
<xsl:when test="parent::msup">-0.4ex</xsl:when>
<xsl:when test="parent::msubsup">0.15ex</xsl:when>
</xsl:choose>
</xsl:attribute>
<xsl:copy>
<xsl:apply-templates select="#* | node()"/>
</xsl:copy>
</mpadded>
</xsl:template>
</xsl:stylesheet>

Getting rid of namespace added to the inner element <i>,<b>, <mpval>

Namespace getting added to the inner element <i>,<b>, <mpval>. I want to get rid of this namespace.
My XML:
<Container xmlns="http://www.sss.org/schema/"
xmlns:meta="http://www.sss.org/schema/tangier/metadata">
<cs-properties>
My Parent level text 1
<mp>
text1 of first child <b> in bold</b>
<mpval>36-37</mpval>
text2 of child <i> in italic </i>
</mp>
My Parent level text2 in <i>italic</i> also in <b>bold </b>
</cs-properties>
</Container>
When I apply below XSL, I get namespace added to <i> element. Want to get rid of it.
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sub="http://www.sss.org/schema"
exclude-result-prefixes="xsl sub">
<xsl:variable name="ns" select="'http://www.sss.org/schema/'" />
<xsl:output indent="no" omit-xml-declaration="yes"/>
<xsl:variable name="inlineElements" select="'b','i','sub','sup'"/>
<xsl:template match="node()|#*">
<xsl:copy>
<xsl:apply-templates select="node()|#*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="sub:cs-properties">
<!--<properties xmlns= "{$ns}">-->
<xsl:element name="cs-properties" namespace="{$ns}" >
<xsl:for-each-group select="node()" group-adjacent="self::text() or self::node()
[name()=$inlineElements]">
<xsl:choose>
<xsl:when test="current-grouping-key()=true()">
<parenttext>
<xsl:copy-of select="current-group()" copy-namespaces="no" />
</parenttext>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each-group>
<!--</properties>-->
</xsl:element>
</xsl:template>
<xsl:template match="sub:mp|sub:abs-max">
<xsl:element name="{name()}">
<xsl:for-each-group select="node()" group-adjacent="self::text() or self::node()
[name()=$inlineElements]">
<xsl:choose>
<xsl:when test="current-grouping-key()=true()">
<childtext>
<xsl:copy-of select="current-group()" copy-namespaces="no"/>
</childtext>
</xsl:when>
<xsl:otherwise>
<!--<xsl:apply-templates select="."/>-->
<xsl:copy-of select="current-group()" copy-namespaces="no"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each-group>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Result:
<Container xmlns="http://www.sss.org/schema"
xmlns:meta="http://www.sss.org/schema/tangier/metadata"><cs-properties><parenttext
xmlns="">
My Parent level text 1
</parenttext><mp xmlns=""><childtext>
text1 of first child <b xmlns="http://www.sss.org/schema"> in
bold</b></childtext><mpval xmlns="http://www.sss.org/schema">36-
37</mpval><childtext>
text2 of child <i xmlns="http://www.sss.org/schema"> in italic </i>
</childtext></mp><parenttext xmlns="">
My Parent level text2 in <i
xmlns="http://www.sss.org/schema">italic</i> also in <b
xmlns="http://www.sss.org/schema">bold </b></parenttext></cs-
properties></Container>
You can avoid the <parenttext xmlns=""> either by using <parenttext xmlns="http://www.sss.org/schema/"> in your markup or by putting xmlns="http://www.sss.org/schema/" on the styleheet's root element. The latter would affect all result elements which might be needed if you have them in more places in the stylesheet.

Grouping on Multiple Field

I am generating XML file from Database as below...
<?xml version = '1.0'?>
<T0019>
<IFTA_ACCOUNT>
<IFTA_CARRIER_ID_NUMBER>705</IFTA_CARRIER_ID_NUMBER>
<IFTA_LICENSE_NUMBER>631227666</IFTA_LICENSE_NUMBER>
<IFTA_BASE_COUNTRY>US</IFTA_BASE_COUNTRY>
<IFTA_BASE_STATE>AL</IFTA_BASE_STATE>
<IFTA_STATUS_CODE>0 </IFTA_STATUS_CODE>
<IFTA_STATUS_DATE>2009-01-01</IFTA_STATUS_DATE>
<IFTA_ISSUE_DATE>2009-01-01</IFTA_ISSUE_DATE>
<IFTA_EXPIRE_DATE>2009-12-01</IFTA_EXPIRE_DATE>
<IFTA_UPDATE_DATE>2008-12-30</IFTA_UPDATE_DATE>
<NAME_TYPE>LG</NAME_TYPE>
<NAME>K D L TRUCKING INC</NAME>
<ADDRESS_TYPE>PH</ADDRESS_TYPE>
<STREET_LINE_1>200 MARTIN LANE</STREET_LINE_1>
<CITY>OHATCHEE</CITY>
<STATE>AL</STATE>
<ZIP_CODE>36271</ZIP_CODE>
<COUNTY>CALHOUN COUNTY</COUNTY>
<COUNTRY>US</COUNTRY>
</IFTA_ACCOUNT>
<IFTA_ACCOUNT>
<IFTA_CARRIER_ID_NUMBER>705</IFTA_CARRIER_ID_NUMBER>
<IFTA_LICENSE_NUMBER>631227666</IFTA_LICENSE_NUMBER>
<IFTA_BASE_COUNTRY>US</IFTA_BASE_COUNTRY>
<IFTA_BASE_STATE>AL</IFTA_BASE_STATE>
<IFTA_STATUS_CODE>0 </IFTA_STATUS_CODE>
<IFTA_STATUS_DATE>2009-01-01</IFTA_STATUS_DATE>
<IFTA_ISSUE_DATE>2009-01-01</IFTA_ISSUE_DATE>
<IFTA_EXPIRE_DATE>2009-12-01</IFTA_EXPIRE_DATE>
<IFTA_UPDATE_DATE>2008-12-30</IFTA_UPDATE_DATE>
<NAME_TYPE>LG</NAME_TYPE>
<NAME>K D L TRUCKING INC</NAME>
<ADDRESS_TYPE>MA</ADDRESS_TYPE>
<STREET_LINE_1>200 MARTIN LANE</STREET_LINE_1>
<CITY>OHATCHEE</CITY>
<STATE>AL</STATE>
<ZIP_CODE>36271</ZIP_CODE>
<COUNTRY>US</COUNTRY>
</IFTA_ACCOUNT>
</T0019>
I have taken first two records from generated XSLT.
With the use of XSLT I have tried lot to group record on basis of
IFTA_LICENSE_NUMBER,IFTA_BASE_COUNTRY,IFTA_BASE_ST ATE,NAME_TYPE,ADDRESS_TYPE but i failed to generated XML like this..
<?xml version="1.0" encoding="UTF-8" ?>
<T0019>
<IFTA_ACCOUNT>
<IFTA_CARRIER_ID_NUMBER>705</IFTA_CARRIER_ID_NUMBER>
<IFTA_BASE_COUNTRY>US</IFTA_BASE_COUNTRY>
<IFTA_BASE_STATE>AL</IFTA_BASE_STATE>
<IFTA_LICENSE_NUMBER>631227666</IFTA_LICENSE_NUMBER>
<IFTA_STATUS_CODE>0</IFTA_STATUS_CODE>
<IFTA_STATUS_DATE>2009-01-01</IFTA_STATUS_DATE>
<IFTA_ISSUE_DATE>2009-01-01</IFTA_ISSUE_DATE>
<IFTA_EXPIRE_DATE>2009-12-01</IFTA_EXPIRE_DATE>
<IFTA_UPDATE_DATE>2008-12-30</IFTA_UPDATE_DATE>
<IFTA_NAME>
<NAME_TYPE>LG</NAME_TYPE>
<NAME>K D L TRUCKING INC</NAME>
<IFTA_ADDRESS>
<ADDRESS_TYPE>PH</ADDRESS_TYPE>
<STREET_LINE_1>200 MARTIN LANE</STREET_LINE_1>
<STREET_LINE_2 />
<CITY>OHATCHEE</CITY>
<STATE>AL</STATE>
<ZIP_CODE>36271</ZIP_CODE>
<COUNTY>CALHOUN COUNTY</COUNTY>
<COUNTRY>US</COUNTRY>
</IFTA_ADDRESS>
<IFTA_ADDRESS>
<ADDRESS_TYPE>MA</ADDRESS_TYPE>
<STREET_LINE_1>200 MARTIN LANE</STREET_LINE_1>
<STREET_LINE_2 />
<CITY>OHATCHEE</CITY>
<STATE>AL</STATE>
<ZIP_CODE>36271</ZIP_CODE>
<COUNTY />
<COUNTRY>US</COUNTRY>
</IFTA_ADDRESS>
</IFTA_NAME>
</IFTA_ACCOUNT>
</T0019>
Your example input records have two different ADDRESS_TYPE values, so if you were grouping by ADDRESS_TYPE, these two would be distinct. And since your output also shows the two distinct values, I assume that you don't really want ADDRESS_TYPE in your list of grouping keys. Is that the real problem?
The XSLT spec gives two strategies for composite keys. When I tried the 'concat' strategy with your data, and with your list of keys minus ADDRESS_TYPE, it grouped these two records together.
Thanks , I have applied following XSLT to solve this Problem.
<xsl:stylesheet
version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="T0019">
<xsl:copy>
<xsl:for-each-group select="IFTA_ACCOUNT" group-by="IFTA_LICENSE_NUMBER">
<xsl:for-each-group select="current-group()" group-by="IFTA_BASE_COUNTRY">
<xsl:for-each-group select="current-group()" group-by="IFTA_BASE_STATE">
<IFTA_ACCOUNT>
<xsl:apply-templates select="IFTA_CARRIER_ID_NUMBER|IFTA_BASE_COUNTRY|IFTA_BASE_STATE|IFTA_LICENSE_NUMBER|IFTA_STATUS_CODE|IFTA_STATUS_DATE|IFTA_ISSUE_DATE|IFTA_EXPIRE_DATE|IFTA_UPDATE_DATE"/>
<xsl:for-each-group select="current-group()" group-by="NAME_TYPE">
<IFTA_NAME>
<xsl:apply-templates select="NAME_TYPE|NAME"/>
<xsl:for-each select="current-group()">
<IFTA_ADDRESS>
<xsl:apply-templates select="ADDRESS_TYPE|STREET_LINE_1|STREET_LINE_2|CITY|STATE|ZIP_CODE|COUNTY|COUNTRY"/>
</IFTA_ADDRESS>
</xsl:for-each>
</IFTA_NAME>
</xsl:for-each-group>
</IFTA_ACCOUNT>
</xsl:for-each-group>
</xsl:for-each-group>
</xsl:for-each-group>
</xsl:copy>
</xsl:template>
<xsl:template match="IFTA_CARRIER_ID_NUMBER">
<IFTA_CARRIER_ID_NUMBER>
<xsl:value-of select="."/>
</IFTA_CARRIER_ID_NUMBER>
</xsl:template>
<xsl:template match="IFTA_LICENSE_NUMBER">
<IFTA_LICENSE_NUMBER>
<xsl:value-of select="."/>
</IFTA_LICENSE_NUMBER>
</xsl:template>
<xsl:template match="IFTA_BASE_COUNTRY">
<IFTA_BASE_COUNTRY>
<xsl:value-of select="."/>
</IFTA_BASE_COUNTRY>
</xsl:template>
<xsl:template match="IFTA_BASE_STATE">
<IFTA_BASE_STATE>
<xsl:value-of select="."/>
</IFTA_BASE_STATE>
</xsl:template>
<xsl:template match="IFTA_STATUS_CODE">
<IFTA_STATUS_CODE>
<xsl:value-of select="."/>
</IFTA_STATUS_CODE>
</xsl:template>
<xsl:template match="IFTA_STATUS_DATE">
<IFTA_STATUS_DATE>
<xsl:value-of select="."/>
</IFTA_STATUS_DATE>
</xsl:template>
<xsl:template match="IFTA_ISSUE_DATE">
<IFTA_ISSUE_DATE>
<xsl:value-of select="."/>
</IFTA_ISSUE_DATE>
</xsl:template>
<xsl:template match="IFTA_EXPIRE_DATE">
<IFTA_STATUS_DATE>
<xsl:value-of select="."/>
</IFTA_STATUS_DATE>
</xsl:template>
<xsl:template match="IFTA_UPDATE_DATE">
<IFTA_ISSUE_DATE>
<xsl:value-of select="."/>
</IFTA_ISSUE_DATE>
</xsl:template>
<xsl:template match="NAME_TYPE">
<NAME_TYPE>
<xsl:value-of select="."/>
</NAME_TYPE>
</xsl:template>
<xsl:template match="NAME">
<NAME_TYPE>
<xsl:value-of select="."/>
</NAME_TYPE>
</xsl:template>
<xsl:template match="ADDRESS_TYPE">
<ADDRESS_TYPE>
<xsl:value-of select="."/>
</ADDRESS_TYPE>
</xsl:template>
<xsl:template match="STREET_LINE_1">
<STREET_LINE_1>
<xsl:value-of select="."/>
</STREET_LINE_1>
</xsl:template>
<xsl:template match="STREET_LINE_2">
<STREET_LINE_2>
<xsl:value-of select="."/>
</STREET_LINE_2>
</xsl:template>
<xsl:template match="CITY">
<CITY>
<xsl:value-of select="."/>
</CITY>
</xsl:template>
<xsl:template match="STATE">
<STATE>
<xsl:value-of select="."/>
</STATE>
</xsl:template>
<xsl:template match="ZIP_CODE">
<ZIP_CODE>
<xsl:value-of select="."/>
</ZIP_CODE>
</xsl:template>
<xsl:template match="COUNTY">
<COUNTY>
<xsl:value-of select="."/>
</COUNTY>
</xsl:template>
<xsl:template match="COUNTRY">
<COUNTRY>
<xsl:value-of select="."/>
</COUNTRY>
</xsl:template>
</xsl:stylesheet>
Thanks to all for your wonderful help.