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 8338129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:29:52+00:00 2026-06-09T04:29:52+00:00

I am trying to apply xsl(using apply-template) to a xml, here is the xml,

  • 0

I am trying to apply xsl(using apply-template) to a xml,

here is the xml,

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
        <SearchResponse xmlns="http://xyz/abcApi">
            <SearchResult>
                <Status>
                    <StatusCode>01</StatusCode>
                    <Description>Successful</Description>
                    <Category>SR</Category>
                </Status>
                <Result>
                    <WSResult>
                        <Index>1</Index>
                        <CityId>111</CityId>
                    </WSResult>
                    <WSResult>
                        <Index>2</Index>
                        <CityId>111</CityId>
                    </WSResult>
                </Result>
                <SessionId>1fc15f22-a670-4f33-b050-c93fa3184cb1</SessionId>
                <IsDomestic>true</IsDomestic>
            </SearchResult>
        </SearchResponse>
    </soap:Body>
</soap:Envelope>

and xsl is,

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
        <Response>
            <Param>
                <Ref>
                    <Results>
                        <xsl:apply-templates select="//SearchResponse/SearchResult/Result/WSResult"/>
                    </Results>
                </Ref>
            </Param>
        </Response>
    </xsl:template>
    <xsl:template match="WSResult">
        <Result>
            <Property>
                <xsl:attribute name="Id"><xsl:value-of select="position()"/></xsl:attribute>
                <xsl:attribute name="CityCode"><xsl:value-of select="CityId"/></xsl:attribute>
            </Property>
        </Result>
    </xsl:template>
</xsl:stylesheet>

this xml is unable to apply specify xsl above. please suggest the solution.

  • 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-06-09T04:29:54+00:00Added an answer on June 9, 2026 at 4:29 am

    This is because you should specify the namespace in your XPath expressions.
    First you add a namespace in the header (I chose “search” for the prefix, but you can change that). Then you add this prefix to all your element names:

        <?xml version="1.0" encoding="UTF-8"?>
        <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:search="http://xyz/abcApi">
            <xsl:template match="/">
                <Response>
                    <Param>
                        <Ref>
                            <Results>
                                <xsl:apply-templates select="//search:SearchResponse/search:SearchResult/search:Result/search:WSResult"/>
                            </Results>
                        </Ref>
                    </Param>
                </Response>
            </xsl:template>
            <xsl:template match="search:WSResult">
                <Result>
                    <Property>
                        <xsl:attribute name="Id"><xsl:value-of select="position()"/></xsl:attribute>
                        <xsl:attribute name="CityCode"><xsl:value-of select="search:CityId"/></xsl:attribute>
                    </Property>
                </Result>
            </xsl:template>
        </xsl:stylesheet>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to sort an xml using xsl. Got some sample from xml.com.
Below I'm trying to match certain nodes. <xsl:template match=nodes> <element> <xsl:apply-templates select=nodes mode=different />
I am trying to create hyperlinks using XML information and XSLT templates. Here is
I am trying to apply a XSL style sheet on a source xml and
I'm trying to apply an xlst transformation using the following file. This is very
I am trying to make the transition from using call-template to using applay templates
i'm trying to implement paging in xml using this code and got around to
I'm trying to use XML files and XSL stylesheets instead of ordinary phtml templates
Here is the basic XSL. I am trying to pull out the element q_DECISION_NUMBER
I am trying to insert xml elements into an xml file using XSLT. I

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.