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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:17:08+00:00 2026-06-17T08:17:08+00:00

i want to print each string node as a li item from the following

  • 0

i want to print each “string” node as a li item from the following xml:

<soapenv:Envelope 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:soapenv="http://schemas.url.org/url/envelope/"
>
    <soapenv:Header>
        <MultiSpeakMsgHeader 
            Version="" UserID="" 
            Pwd="" AppName="xx" AppVersion="x" 
            Company="xxx" xmlns="http://www.url.org/Version_3.0"
        />
    </soapenv:Header>
    <soapenv:Body>
        <GetMethodsResponse xmlns="http://www.url.org/Version_3.0">
            <GetMethods>
                <string>GetDomainMembers</string>
                <string>GetDomainNames</string>
                <string>GetMethods</string>
                <string>pingURL</string>
                <string>GetAllMeters</string>
                <string>GetAllServiceLocations</string>
                <string>GetAllCustomers</string>
                <string>GetCustomerByCustId</string>
                <string>GetServiceLocationByAccountNo</string>
                <string>GetServiceLocationByMeterNo</string>
                <string>ReadingChangedNotification</string>
            </GetMethods>
        </GetMethodsResponse>
    </soapenv:Body>
</soapenv:Envelope>

i currently have the following xsl code –

<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:exslt="http://exslt.org/common"
>
    <xsl:output method="html" />

    <xsl:template match="/GetMethods">
        <ul>
            <xsl:for-each select="GetMethods/string">
                <li>
                    <xsl:value-of select="string"/><br/>
                </li>
            </xsl:for-each>    
        </ul>
    </xsl:template>
</xsl:stylesheet>

but all this does is prints each string node as a long line with no list formatting. any help would be appreciated.

i want this simple output:

    <ul>
        <li>GetDomainMembers</li>
        <li>GetDomainNames</li>
        <li>GetMethods</li>
        <li>pingURL</li>
        <li>GetAllMeters</li>
        <li>GetAllServiceLocations</li>
        <li>GetAllCustomers</li>
        <li>GetCustomerByCustId</li>
        <li>GetServiceLocationByAccountNo</li>
        <li>GetServiceLocationByMeterNo</li>
        <li>ReadingChangedNotification</li>
    </ul>

i’m currently getting this output (there is no formatting):

                                          GetDomainMembers            GetDomainNames            GetMethods            pingURL            GetAllMeters            GetAllServiceLocations            GetAllCustomers            GetCustomerByCustId            GetServiceLocationByAccountNo            GetServiceLocationByMeterNo            ReadingChangedNotification                  
  • 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-17T08:17:10+00:00Added an answer on June 17, 2026 at 8:17 am
    <xsl:stylesheet version="1.0" 
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
        xmlns:exslt="http://exslt.org/common"
        xmlns:response="http://www.url.org/Version_3.0"
        exclude-result-prefixes="exslt response"
    >
        <xsl:output method="html" />
    
        <xsl:template match="/">
            <xsl:apply-templates select="//response:GetMethods" />
        </xsl:template>
    
        <xsl:template match="response:GetMethods">
            <ul>
                <xsl:apply-templates select="response:string" />
            </ul>
        </xsl:template>
    
        <xsl:template match="response:string">
            <li>
                <xsl:value-of select="." />
            </li>
        </xsl:template>
    </xsl:stylesheet>
    

    Notes:

    • First we must make known the namespace that your response element is in. In your case the namespace URI is http://www.url.org/Version_3.0, which we need to assign to a prefix to make it usable in the XSLT. I chose to call that prefix response.
    • Next we need to control the output of the XSLT. This is easiest by matching the root node (<xsl:template match="/">) and defining where to go next by directly selecting //response:GetMethods for processing.
    • Templates for response:GetMethods and response:string define the rest of the transformation.
    • Lastly we must make sure that XML namespace prefixes do not show up in the resulting HTML. That’s what exclude-result-prefixes does.
    • See it here: http://www.xmlplayground.com/kS1Cul
    • You can also read What are the differences between 'call-template' and 'apply-templates' in XSL? where I explained <xsl:apply-templates> a little closer.
    • In general you should avoid writing <xsl:for-each> and choose <xsl:apply-templates> instead.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to print each element of an xml document on a new line
Ajax calls an array of four strings, I then want to print each string
I want to search each line for the word FAILED , then print the
I want to print just the HTTP status code for a web page retrieved
I want to print an integer number in binary mode using following function: #include
I want to print the ID of the comment (eg. 10151828637085391_33268745 ) from this
Working on dom html . I want to convert node value to string: $html
I want to print each digit of pi number as a colored pixel, so,
I have an XML containing blog posts. Each post contains a date node. I
I am reading an xml file and want to perform string operations on the

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.