Jump to content

xsl comment not appearing


sbutt
 Share

Recommended Posts

I am trying to get xsl comments on my XMLSpy XSLT output console, but the comment is not appearing. My xslt script is:

<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.opentravel.org/OTA/2003/05" xmlns:ota="http://www.opentravel.org/OTA/2003/05" exclude-result-prefixes="ota xsl">	<xsl:output encoding="UTF-8" version="2.0" method="xml"/>	<xsl:strip-space elements="*"/>	<xsl:variable name="no_of_adult_persons" select="count(//ota:PassengerListItems/ota:PassengerListItem[@Code = '10'])"/>	<xsl:variable name="adult_persons_prices">		<xsl:call-template name="adult">			<xsl:with-param name="nodelist_adult" select="//ota:PassengerListItems/ota:PassengerListItem[@Code = '10']"/>			<xsl:with-param name="nodelist" select="//ota:CostingItem"/>		</xsl:call-template>	</xsl:variable>	<xsl:template name="adult">		<xsl:param name="nodelist_adult"/>		<xsl:param name="nodelist"/>		<xsl:param name="counter">1</xsl:param>		<xsl:param name="sum">0.00</xsl:param>		<xsl:variable name="rph" select="$nodelist_adult[$counter]/@RPH"/>		<xsl:comment>			<xsl:value-of select="count($nodelist_adult)"/>		</xsl:comment>		<xsl:comment>			<xsl:value-of select="count($nodelist)"/>		</xsl:comment>		<xsl:comment>			<xsl:value-of select="$counter"/>		</xsl:comment>		<xsl:comment>			<xsl:value-of select="$sum"/>		</xsl:comment>		<xsl:comment>			<xsl:value-of select="$nodelist_adult[$counter]/@RPH"/>		</xsl:comment>		<xsl:comment>=============================</xsl:comment>		<xsl:variable name="sum_temp">			<xsl:value-of select="$sum + $nodelist[$counter]/ota:UnitCost/@Amount"/>		</xsl:variable>		<xsl:choose>			<xsl:when test="$counter < count($nodelist_adult)">				<xsl:call-template name="adult">					<xsl:with-param name="nodelist_adult" select="$nodelist_adult"/>					<xsl:with-param name="nodelist" select="$nodelist"/>					<xsl:with-param name="counter" select="$counter + 1"/>					<xsl:with-param name="sum" select="$sum_temp"/>				</xsl:call-template>			</xsl:when>			<xsl:otherwise>				<xsl:value-of select="$sum_temp"/>			</xsl:otherwise>		</xsl:choose>	</xsl:template></xsl:stylesheet>

and xml input

<?xml version="1.0" encoding="UTF-8"?><OTA_TT_PkgBookRS Version="1.0" xmlns="http://www.opentravel.org/OTA/2003/05">	<Success/>	<PackageReservation>		<UniqueID ID="7305042" Type="14"/>		<Package BrandCode="OHG" ProductCode="201842820" Status="Confirmed">			<DateRange End="2011-05-10" Start="2011-04-26"/>			<ItineraryItems>				<ItineraryItem RPH="1" Status="Confirmed">					<Accommodation>						<Identity HotelCode="201842820" HotelName="Broncemar"/>						<DateRange Duration="P14D" End="2011-05-10" Start="2011-04-26"/>						<RoomProfiles>							<RoomProfile BookingCode="201842820" RoomTypeCode="1011907">								<GuestCounts IsPerRoom="true">									<GuestCount AgeQualifyingCode="10" Count="2"/>								</GuestCounts>								<PassengerRPHs ListOfPassengerRPH="1 2"/>							</RoomProfile>						</RoomProfiles>						<MealPlans>							<MealPlan Code="BB" MealType="B & B">								<CustomerCounts>									<CustomerCount Code="10" Quantity="2"/>								</CustomerCounts>								<PassengerRPHs ListOfPassengerRPH="1 2"/>							</MealPlan>						</MealPlans>					</Accommodation>				</ItineraryItem>			</ItineraryItems>		</Package>		<ContactDetail>			<PersonName>				<NamePrefix>Mr</NamePrefix>				<GivenName>Mark</GivenName>				<Surname>Dost</Surname>			</PersonName>			<Telephone PhoneNumber="02349711464"/>			<Address>				<StreetNmbr>Unistr.90</StreetNmbr>				<CityName>Bochum</CityName>				<PostalCode>44789</PostalCode>				<CountryName Code="DE">Deutschland</CountryName>			</Address>			<Email>mark.dost@iff.traveltainment.de</Email>		</ContactDetail>		<PassengerListItems>			<PassengerListItem BirthDate="1986-01-12" Code="10" Gender="Male" RPH="1">				<Name>					<NamePrefix>Mr</NamePrefix>					<GivenName>Mark</GivenName>					<Surname>Dost</Surname>				</Name>			</PassengerListItem>			<PassengerListItem BirthDate="1987-01-12" Code="10" Gender="Female" RPH="2">				<Name>					<NamePrefix>Mrs</NamePrefix>					<GivenName>Claudia</GivenName>					<Surname>Ollmann</Surname>				</Name>			</PassengerListItem>		</PassengerListItems>		<InvoiceDetail>			<CostingItems>				<CostingItem CostBasis="7" PassengerRPH="1">					<UnitCost Amount="398.01" CurrencyCode="EUR"/>				</CostingItem>				<CostingItem CostBasis="7" PassengerRPH="2">					<UnitCost Amount="57.5000" CurrencyCode="EUR"/>				</CostingItem>			</CostingItems>			<GrossAmount Amount="455.51" CurrencyCode="EUR"/>		</InvoiceDetail>	</PackageReservation></OTA_TT_PkgBookRS>

Could someone please help me out?I am using xslt 1.0 xalan processor in my xmlspy

Link to comment
Share on other sites

Does this console print the text of the output? Just asking... some consoles assume (X)HTML ouptut, and treat the output like that. If you can see any element names, then that shouldn't be the problem.Also, are you sure your template is executed? I see it output nothing but comments... Try this for debugging's sake:

	<xsl:template name="adult">		<xsl:param name="nodelist_adult"/>		<xsl:param name="nodelist"/>		<xsl:param name="counter">1</xsl:param>		<xsl:param name="sum">0.00</xsl:param>		<xsl:variable name="rph" select="$nodelist_adult[$counter]/@RPH"/>		<h1>This text must NOT be visualized as a heading</h1>

And see what's in the ouptut console.

Link to comment
Share on other sites

Does this console print the text of the output? Just asking... some consoles assume (X)HTML ouptut, and treat the output like that. If you can see any element names, then that shouldn't be the problem.Also, are you sure your template is executed? I see it output nothing but comments... Try this for debugging's sake:
	<xsl:template name="adult">		<xsl:param name="nodelist_adult"/>		<xsl:param name="nodelist"/>		<xsl:param name="counter">1</xsl:param>		<xsl:param name="sum">0.00</xsl:param>		<xsl:variable name="rph" select="$nodelist_adult[$counter]/@RPH"/>		<h1>This text must NOT be visualized as a heading</h1>

And see what's in the ouptut console.

thanks i got the problem solved. i needed a template to output the variables value inside xsl:comment. Thanks anyway!
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...