Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7515557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:50:36+00:00 2026-05-30T00:50:36+00:00

I have not much experience in xsl with namespace and i am using xsl

  • 0

I have not much experience in xsl with namespace and i am using xsl for transforming the xml.

Here is the xml input,

<GetAvailability>
    <RequestSection>
        <Hotel>
            <StayDateRange Start="25/02/2012" End="27/02/2012"/>
            <HotelSearchCriteria>
                <HotelRef HotelCityName="MUMBAI" HotelCityCode="666" Currency="USD" Nationality="US"/>
                <Rooms>
                <Room Type="Single" ChildCount="1" AdultsCount="1" ExtraBed="0" RateBasis="-1">
                    <Ages>
                        <Age>5</Age>
                    </Ages>
                </Room>
            </Rooms>

            </HotelSearchCriteria>
        </Hotel>
    </RequestSection>
</GetAvailability>

I am expecting the output as,

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:urn="urn:b2bHotelSOAP" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
    <soap:Header/>
    <soap:Body>
        <urn:getAvailableHotel soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
            <destinationId xsi:type="xsd:string">666</destinationId>
            <checkIn xsi:type="xsd:date">2011-09-01</checkIn>
            <checkOut xsi:type="xsd:date">2011-09-03</checkOut>
            <currency xsi:type="xsd:string">USD</currency>
            <clientNationality xsi:type="xsd:string">US</clientNationality>
            <onRequest xsi:type="xsd:boolean">True</onRequest>
                        <rooms xsi:type="urn:roomArray" soapenc:arrayType="urn:paxesArray">
            <paxes>
                <pax>
                    <paxType>Adult</paxType>
                </pax>
            </paxes>
                       </rooms>

        </urn:getAvailableHotel>
    </soap:Body>
</soap:Envelope>

EDIT : here is the xsl i have tried,

 <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <xsl:template name="start" match="/">
        <xsl:if test="//HotelSearchCriteria/HotelRef/@HotelCityName != ''">
            <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:urn="urn:b2bHotelSOAP" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
                <soap:Header/>
                <soap:Body>
                    <urn:getAvailableHotel soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
                        <apiKey xsi:type="xsd:string">
                            <xsl:value-of select="//ApiKey"/>
                        </apiKey>
                        <destinationId xsi:type="xsd:string">
                            <xsl:value-of select="//HotelRef/@HotelCityCode"/>
                        </destinationId>
                        <checkIn xsi:type="xsd:date">
                            <xsl:value-of select="//StayDateRange/@Start"/>
                        </checkIn>
                        <checkOut xsi:type="xsd:date">
                            <xsl:value-of select="//StayDateRange/@End"/>
                        </checkOut>
                        <currency xsi:type="xsd:string">
                            <xsl:value-of select="//Currency"/>
                        </currency>
                        <clientNationality xsi:type="xsd:string">
                            <xsl:value-of select="//Nationality"/>
                        </clientNationality>
                        <onRequest xsi:type="xsd:boolean">
                            <xsl:value-of select="//HotelAdvanacedSearchCriteria/Available"/>
                        </onRequest>
                        <rooms xsi:type="urn:roomArray" soapenc:arrayType="urn:paxesArray">
                            <xsl:apply-templates select="//HotelSearchCriteria/Rooms/Room" mode="search"/>

                        </rooms>
                        <filters xsi:type="urn:filterArray" soapenc:arrayType="urn:filter"/>
                    </urn:getAvailableHotel>
                </soap:Body>
            </soap:Envelope>
        </xsl:if>
    </xsl:template>
    <xsl:template match="Room">
        <paxes>
            <xsl:attribute name="xsi:type">urn:paxesArray</xsl:attribute>

        </paxes>
    </xsl:template>

</xsl:stylesheet>

please suggest me the solution for this query.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T00:50:38+00:00Added an answer on May 30, 2026 at 12:50 am

    It seems like your actual problem is in the Room template …

    <xsl:template match="Room">
        <paxes>
            <xsl:attribute name="xsi:type">urn:paxesArray</xsl:attribute>
        </paxes>
    </xsl:template>
    

    … because your Xsl will complain it doesn’t recognize the xsi namespace.

    To fix this, you have to add the namespace to all the templates where you intend to use it – or add it at the top level inside <xsl:stylesheet />.

    <xsl:template match="Room" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <paxes>
            <xsl:attribute name="xsi:type">urn:paxesArray</xsl:attribute>
        </paxes>
    </xsl:template>
    

    or – if you want to keep the way you added your attributes in your start template

    <xsl:template match="Room" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <paxes xsi:type="urn:paxesArray">
            <xsl:apply-templates />
        </paxes>
    </xsl:template>
    

    And you have to change applying your Room template inside rooms to just <apply-templates />:

    <rooms xsi:type="urn:roomArray" soapenc:arrayType="urn:paxesArray">
        <xsl:apply-templates />
    </rooms>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I do not have much experience using frameworks or anything so that leaves me
We are using clearcase as our SCM. I have not much experience with clearcase.
I'm currently extending a Site and do not have much experience with symfony. Currently
I have 4 years experience on DotNet, not much. I now learned developing for
I have a fair amount of JSP and JSF experience. Not so much with
I have not had much experience with VBA, but I sometimes use it at
I do not have much experience coding systems dealing with web-services. Please help me
i'm a beginner in android and have not much experience on java... I have
I have not had much experience with Webservices or API's. We have a website
I do not have much experience in Java authentication frameworks and authentication workflow in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.