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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:40:36+00:00 2026-05-14T08:40:36+00:00

I have some XML/TEI documents, and i’m writing an XSLT 2.0 to extract their

  • 0

I have some XML/TEI documents, and i’m writing an XSLT 2.0 to extract their content.

Almost all TEI documents has no namespace, but one has the default namespace (xmlns="http://www.tei-c.org/ns/1.0").
So all documents has the same aspect, with unqulified tags like <TEI> or <teiHeader>, but if I try to extract the content, all works with “non-namespaced-documents”, but nothing (of course) is extracted from the namespaced-document.

So i used the attribute xpath-default-namespace="http://www.tei-c.org/ns/1.0" and now (of course) the only document working is the namespaced one.

I can’t edit documents at all, so what I’m asking is if there’s a way to change dynamically the xpath-default-namespace in order to make work xpaths like //teiHeader both with namespaced and non-namespaced documents

  • 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-14T08:40:37+00:00Added an answer on May 14, 2026 at 8:40 am

    If you are using XSLT 2.0, then you do have the option for a wildcard match for the namespace in a node test.

    e.g. //*:teiHeader

    http://www.w3.org/TR/xpath20/#node-tests

    A node test can also have the form
    *:NCName. In this case, the node test is true for any node of the principal
    node kind of the step axis whose local
    name matches the given NCName,
    regardless of its namespace or lack of
    a namespace.

    This is functionally equivalent to Dimitre Novatchev’s example, but a little shorter/easier to type.

    However, this will only work in XSLT/XPATH 2.0.

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

Sidebar

Related Questions

I have some xml documents I need to run queries on. I've created some
I have some XML documents: events.xml: <?xml version=1.0 encoding=UTF-8?> <events> <event> <id>9</id> <region>3</region> <region>12</region>
I have some XML that I am de-serializing and all works fine apart from
I have some xml with default namespace <a xmlns='urn:test.Schema'><b/><b/></a> and want to count the
I have some XML that has creating using an XmlDocument object in C#. I
I have some XML data that I want to convert to HTML with XSLT
I have some XML that has an extra element and I want it gone.
I have some XML that looks something like this: <Root> <Documents> <Document id=1/> </Documents>
I have some xml being returned in sharepoint, Im using xslt to create the
I have some XML that is structured like this: <whatson> <productions> <production> <category>Film</category> </production>

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.