You get the unwanted "1" because the default template rule is to copy
the text content to the output, and this rule is kicking in for the
<TOUR_COUNT> element. Either provide a specific template rule for this
element:
<xsl:template match="TOUR_COUNT"/>
or avoid applying-templates to this element, by doing:
<xsl:template match="/">
<xsl:apply-templates
select="AVAILABILITYFARE_REQUEST/TOURDETAILS/TOUR"/>
</xsl:template>
Michael Kay
Software AG
home: Michael(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com
-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of
Santosh S N, Noida
Sent: 04 February 2003 05:03
To: Xsl-List (E-mail)
Subject: [xsl] Non-referenced Node being processed
When I process the XML with the XSL given below I get an output of
<?xml version="1.0" encoding="UTF-16"?>
1
<REQUEST>
<MAX_RESP_COUNT>041</MAX_RESP_COUNT>
<TICKET>3</TICKET>
<DEP_CITY_CODE>JFK</DEP_CITY_CODE>
</REQUEST>
Can somebody please tell me why do I get the extra "1"
Immediately before the REQUEST node. and how do I get rid of
it? (This arises from the node TOUR_COUNT in the original XML.)
I get the same result with both XML Spy and Microsoft .NET's
XSL Transform Class.
<!--XSL File-->
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="AVAILABILITYFARE_REQUEST/TOURDETAILS/TOUR">
<REQUEST>
<MAX_RESP_COUNT>041</MAX_RESP_COUNT>
<TICKET>
<xsl:value-of select="TRIP/NUM_TICKETS"/>
</TICKET>
<DEP_CITY_CODE>
<xsl:value-of select="ORIGIN/DEP_CITY_CODE"/>
</DEP_CITY_CODE>
</REQUEST>
</xsl:template>
</xsl:stylesheet>
<!--XML File-->
<?xml version="1.0" encoding="UTF-8"?>
<AVAILABILITYFARE_REQUEST> <TOURDETAILS>
<TOUR_COUNT>1</TOUR_COUNT>
<TOUR>
<ORIGIN>
<DEP_AIRPORT_COUNT/>
<DEP_CITY_CODE>JFK</DEP_CITY_CODE>
<DEP_TIME>0800</DEP_TIME>
<DEP_DAY>01</DEP_DAY>
<DEP_MONTH>JAN</DEP_MONTH>
<DEP_YEAR>2003</DEP_YEAR>
</ORIGIN>
<TRIP>
<NUM_TICKETS>3</NUM_TICKETS>
<PASSENGER>
</PASSENGER>
</TRIP>
</TOUR>
</TOURDETAILS>
</AVAILABILITYFARE_REQUEST>
~Cheers!
Santosh S N
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list