Hi Santosh,
add the follwing before your match\
"<xsl:template match="AVAILABILITYFARE_REQUEST/TOURDETAILS/TOUR">"
<xsl:template match="/">
<xsl:apply-templates
select="/AVAILABILITYFARE_REQUEST/TOURDETAILS/TOUR">
</xsl:apply-templates>
</xsl:template>
The reaon for appearance of "1" is that if you don't specify
<xsl:template match="/">...
element
the following built-in templates are used
<xsl:template match="*|/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="text()|@*">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="*|/" mode="?">
<xsl:apply-templates mode="?"/>
</xsl:template>
<xsl:template match="text()|@*" mode="?">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="processing-instruction()|comment()"/>
<xsl:template match="processing-instruction()|comment()" mode="?"/>
the element
<xsl:template match="text()|@*">
<xsl:value-of select="."/>
</xsl:template>
leads to the printing of "1" the value of element "<TOUR_COUNT>" in your XML
HTH...
regards
Balajee Chandrasekaran
Software Engineer
Majesco Software Inc.
Phone: 91-22-5695 2222 Extn No 7911
------------------------------------
Work
Choose a job you love, and you will never have to
work a day in your life
Confucius, BC 551-479, Chinese Ethical Teacher
---------------------------------------
-----Original Message-----
From: Santosh S N, Noida [mailto:santoshsn(_at_)noida(_dot_)hcltech(_dot_)com]
Sent: Tuesday, February 04, 2003 10:33 AM
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
MASTEK
Investing in relationships
In the US, we're called MAJESCO
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of
Mastek Limited, unless specifically indicated to that effect. Mastek Limited
does not accept any responsibility or liability for it. This e-mail and
attachments (if any) transmitted with it are confidential and/or privileged and
solely for the use of the intended person or entity to which it is addressed.
Any review, re-transmission, dissemination or other use of or taking of any
action in reliance upon this information by persons or entities other than the
intended recipient is prohibited. This e-mail and its attachments have been
scanned for the presence of computer viruses. It is the responsibility of the
recipient to run the virus check on e-mails and attachments before opening
them. If you have received this e-mail in error, kindly delete this e-mail from
all computers.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list