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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:18:38+00:00 2026-06-08T18:18:38+00:00

I am trying to parse an XML document to a website, through a XSLT

  • 0

I am trying to parse an XML document to a website, through a XSLT transformation.

However, to make it work I have to use the following XPath:

/*[name()='standards']/*[name() = 'standard']

Why does the following XPath expression not work?

/standards/standard
  • 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-08T18:18:39+00:00Added an answer on June 8, 2026 at 6:18 pm

    Your problem is the most FAQ in XPath — search for XPath and default namespace and you’ll find many good answers.

    To summarize the problem: XPath interpretes any unprefixed name as belonging to “no namespace”.

    Therefore any unprefixed name in any XPath expression, belonging to some default namespace (not the “no namespace”) isn’t selected.

    One way to continue to use names in the location steps is to indicate to the XPath processor that a specific prefix, say “x” is associated to the default namespace. Then issue:

    /x:standards/x:standard
    

    In .NET such namespace binding (called “registering of namespace”) is done using the XmlNamespaceManager class. See this complete example.

    In XSLT, simply define a namespace at a global level, then specify XPath expressions where each element name is prefixed by the prefix so defined.

    Here is a small example:

    <nums xmlns="some:nums">
      <num>01</num>
      <num>02</num>
      <num>03</num>
      <num>04</num>
      <num>05</num>
      <num>06</num>
      <num>07</num>
      <num>08</num>
      <num>09</num>
      <num>10</num>
    </nums>
    

    To process the above XML document we have this:

    <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:x="some:nums">
     <xsl:output method="text"/>
     <xsl:strip-space elements="*"/>
    
     <xsl:template match="/">
         <xsl:value-of select="/x:nums/x:num[. = 3]"/>
     </xsl:template>
    </xsl:stylesheet>
    

    Applying this transformation to the above XML document correctly selects the wanted element and outputs its string value:

    03
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to parse an xml document that I have created. However xml.Descendants(value)
I'm trying to use XPath to parse an XML document. One of my NSXMLElement's
So I'm trying to parse the following XML document with C#, using System.XML: <root
I'm trying to parse and load an XML document, however I'm getting this exception
I am trying to parse some xml with saxon to make some xpath querying
I'm trying to use SimpleXML to parse an XML document (an ItemLookupResponse for a
I have the following XML document that I have to parse using python's minidom:
I'm trying to use jQuery 1.4.1 to parse an XML document and construct a
Trying to do a simple parse of an XML document. What's the easiest way
I am trying to parse a document that is formatted similar to Xml (but

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.