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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T13:14:50+00:00 2026-05-20T13:14:50+00:00

Right now, I’m able to grab the immediate children of a certain element root

  • 0

Right now, I’m able to grab the immediate children of a certain element “root” and these elements have names that contain dashes. So for example, say these immediate children have names ‘A4-1′,’B3-2’, and ‘C4-3’.

I would like to be able to do something along the lines of the following psuedo-code:

for each immediate child
    print out it's child element figtitle/autonum/@ID

Is there a way to do something like this without concatenating the path into a string? Each time I concat the immediate child values to the rest of its path, I get a string, so I can’t compare it’s attribute value to another value, for example:

<xsl:if test="*['yes' = (PATH)]">
    <xsl:value-of select="PATH[@ID = 'yes']"/> 
</xsl:if>

Where the paths would be:

root/A4-1/figtitle/autonum/@ID
root/B3-2/figtitle/autonum/@ID
root/C4-3/figtitle/autonum/@ID

  • 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-20T13:14:51+00:00Added an answer on May 20, 2026 at 1:14 pm

    The expression you need is:

    /root/*/figtitle/autonum/@ID
    

    this means:

    Select all ID attributes of any autonum element that is a child of a figtitle element that is a grandchild of the top element root.

    If the element root isn’t the top element of the document, then if the expression would be evaluated with the parent of root as the context node, the expression should be:

    root/*/figtitle/autonum/@ID
    

    Explanation:

    The expression:

    someElement/*
    

    selects all elements that are children of the element named someElement that is a child of the context node (current node) against which the expression is evaluated.

    Thus, it is not at all necessary to enumerate explicitly the names of the children of someElement.

    Update: The OP has clarified in a comment that she needs to select only those children of root, whose names contain dashes, numbers and letters.

    This XPath expression:

    root/*[contains(name(), ‘-‘)
    and
    translate(name(), $vAlphaNum, ‘ ‘) = ”]
    /figtitle/autonum/@ID

    selects exactly all such elements.

    Here, the variable $vAlphaNum must be defined to contain all lower and upper case letters and the digits 0-9.

    In XSLT 2.0 one can use the matches() function with a suitable regular expression.

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

Sidebar

Related Questions

Right now I have a script that will get the last five files in
Right now I have a function, in a class that is used to listen
Right now, I have a script which uses PHP's tokenizer to look for certain
Right now I have an application that loads a bunch of thumbnail images into
Right now, I have developed an android app that is available free on the
Right now, I have elements with different z-index , and I want to group
Right now I have a json file that im using to populate data within
Right now I have a small database with two tables that look something like
Right now I have an SSIS package that runs every morning and gives me
Right now, I have code that looks something like this: Private Sub ShowReport(ByVal reportName

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.