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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:32:38+00:00 2026-05-24T22:32:38+00:00

If I have this XSL <?xml version=1.0 encoding=utf-8?> <xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform version=1.0> <xsl:output method=html/> <xsl:output

  • 0

If I have this XSL

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="html"/>
    <xsl:output omit-xml-declaration="yes" encoding="UTF-8"/>

    <xsl:template match='/'>
      <xsl:value-of select="//Description" />
    </xsl:template>
</xsl:stylesheet>

And this XML

<ArrayOfLookupValue xmlns="http://switchwise.com.au/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <LookupValue>
    <Description>AGL</Description>
    <Value>8</Value>
  </LookupValue>
  <LookupValue>
    <Description>Australian Power &amp; Gas</Description>
    <Value>6</Value>
  </LookupValue>
  <LookupValue>
    <Description>EnergyAustralia</Description>
    <Value>13</Value>
  </LookupValue>
  <LookupValue>
    <Description>Origin Energy</Description>
    <Value>9</Value>
  </LookupValue>
  <LookupValue>
    <Description>TRU Energy</Description>
    <Value>7</Value>
  </LookupValue>
</ArrayOfLookupValue>

How do I actually get some data from this line:

<xsl:value-of select="//Description" />

I have spent hours on this and I have come to the conclusion that the xmlns= namespace is what is causing me grief.

Any help greatly appreciated.

BTW the XML is coming from a web service so I can’t just “change” it – I can preprocess it but that isn’t ideal…

Also I have confirmed that removing the namespaces from a mock of the XML does fix the problem.

  • 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-24T22:32:39+00:00Added an answer on May 24, 2026 at 10:32 pm

    This is the most FAQ for both XPath and XSLT.

    The short answer is that in XPath an unprefixed name is considered to belong to “no namespace”. However, in a document with a default namespace the unprefixed names belong to the default namespace.

    Therefore, for such document the expression

    //Description
    

    selects nothing (because there is no Description (or any other) element in the document that belongs to “no namespace” — all element names belong to the default namespace).

    Solution:

    Define a namespace in your XSLT that has the same namespace-uri() as the default namespace of the XML document. Then use the prefix of the so defined namespace for any name used in an Xpath expression:

    <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:x="http://switchwise.com.au/">
        <xsl:output method="html"/>
        <xsl:output omit-xml-declaration="yes" encoding="UTF-8"/>
    
        <xsl:template match='/'>
          <xsl:copy-of select="//x:Description" />
        </xsl:template>
    </xsl:stylesheet>
    

    When this transformation is applied to the provided XML document:

    <ArrayOfLookupValue xmlns="http://switchwise.com.au/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
      <LookupValue>
        <Description>AGL</Description>
        <Value>8</Value>
      </LookupValue>
      <LookupValue>
        <Description>Australian Power &amp; Gas</Description>
        <Value>6</Value>
      </LookupValue>
      <LookupValue>
        <Description>EnergyAustralia</Description>
        <Value>13</Value>
      </LookupValue>
      <LookupValue>
        <Description>Origin Energy</Description>
        <Value>9</Value>
      </LookupValue>
      <LookupValue>
        <Description>TRU Energy</Description>
        <Value>7</Value>
      </LookupValue>
    </ArrayOfLookupValue>
    

    the wanted, correct result is produced:

    <Description xmlns="http://switchwise.com.au/"
    xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
    >AGL</Description>
    <Description xmlns="http://switchwise.com.au/"
    xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
    >Australian Power &amp; Gas</Description>
    <Description xmlns="http://switchwise.com.au/"
    xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
    >EnergyAustralia</Description>
    <Description xmlns="http://switchwise.com.au/"
    xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
    >Origin Energy</Description>
    <Description xmlns="http://switchwise.com.au/"
    xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
    >TRU Energy</Description>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have the following xslt sheet: <?xml version=1.0 encoding=UTF-8 ?> <xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform version=1.0> <xsl:variable
I have a style sheet like this <?xml version=1.0 encoding=utf-8?> <xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform> <xsl:param
I have the following xsl stylesheet: <xsl:stylesheet xmlns=http://www.w3.org/1999/xhtml xmlns:xsl=http://www.w3.org/1999/XSL/Transform> <xsl:output method=xml encoding=utf-8/> <xsl:template match=/>
i have a xsl file as below: -------Begin------ <?xml version=1.0 encoding=utf-8?> <xsl:stylesheet version=2.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform
I have got an XSLT that looks like this: <xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform> <xsl:output method=xml
I have this XSLT document : <xsl:stylesheet version=1.0 xmlns:mstns=http://www.w3.org/2001/XMLSchema xmlns=http://www.w3.org/2001/XMLSchema xmlns:xs=http://www.w3.org/2001/XMLSchema xmlns:msdata=urn:schemas-microsoft-com:xml-msdata xmlns:xsl=http://www.w3.org/1999/XSL/Transform> <xsl:output
I have the following simple XSL style sheet: <?xml version=1.0 encoding=windows-1252?> <xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform xmlns=http://www.w3.org/1999/xhtml
Something's screwy here. I'm trying to parse this XSL file: <?xml version=1.0 encoding=utf-8?> <xsl:stylesheet
I have a XML like this: <?xml version=1.0 encoding=UTF-8?> <Section> <Chapter> <nametable> <namerow> <namecell
I have a XML like this: <?xml version=1.0 encoding=UTF-8?> <nodes> <n c=value2/> <n>Has a

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.