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

  • Home
  • SEARCH
  • 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 8482643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:52:20+00:00 2026-06-10T19:52:20+00:00

I’ve got an XML file which looks somehow like this: <?xml version=’1.0′ encoding=’UTF-8′?> <?xml-stylesheet

  • 0

I’ve got an XML file which looks somehow like this:

<?xml version='1.0' encoding='UTF-8'?>
<?xml-stylesheet type="text/xsl" href="http://url/stylesheet.xsl"?>

<first xmlns="http://www.loc.gov/zing/srw/">
 <element1>And</element1>
 <e2>I said</e2>
 <e3>
  <e4>
   <mods version="3.0" 
   xmlns:bla="http://www.w3.org/1999/xlink" 
   xmlns:bla2="http://www.w3.org/2001/XMLSchema-instance" 
   xmlns="http://www.loc.gov/mods/v3" 
   xsi:schemaLocation="http://www.loc.gov/mods/v3">                                                        
    <f1>What about</f1>
    <f2>Breakfast at Tiffany's</f2>
   </mods>
  </e4>
 </e3>
</first>

On the other hand I have an XSL-file to grab the elements via XPath:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:n="http://www.loc.gov/zing/srw/"
xmlns:o="http://www.loc.gov/mods/v3">

   <xsl:template match="/">
    <html><head></head><body>
     <xsl:value-of select="n:first/n:e2"/>
    </body></html>
   </xsl:template>
</xsl:stylesheet>

With this I can fetch the element e2 saying I said but I have problems to access element f4 saying Breakfast at Tiffany’s . Does XPath assume that the element f4 has two namespaces (the default namespace xmlns=”http://www.loc.gov/zing/srw/&#8221; declared in the root element first and the namespace of the element mods xmlns=”http://www.loc.gov/mods/v3&#8243;) or is the mods namespace xmlns=”http://www.loc.gov/mods/v3&#8243; the only namespace for all childelements of the mods element?
And can I actually access the element e2 easier without the declaration of prefixes in my xsl-file? I am just starting to use XML/XSL, so I hope my question is clear.

  • 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-10T19:52:22+00:00Added an answer on June 10, 2026 at 7:52 pm

    The following XPath expression should work:

    n:first//o:f2
    

    The mods element is in the o namespace, defining prefixes for other namespaces does not change it. Its children inherit the namespace.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
In my XML file chapters tag has more chapter tag.i need to display chapters
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm parsing an XML file, the creators of it stuck in a bunch social
I have an autohotkey script which looks up a word in a bilingual dictionary

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.