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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:23:09+00:00 2026-05-21T20:23:09+00:00

I have an XML structure like the following: <Page Depth=1> <Page Title=Communities Depth=2> <Page

  • 0

I have an XML structure like the following:

<Page Depth="1">
  <Page Title="Communities" Depth="2">
    <Page Title="Blog" iscurrent="true" Depth="3"/>
    <Page Title="Something" Depth="3"/>
    <Page Title="Anything" Depth="3"/>
  </Page>
  <Page Title="News" Depth="2">
    <Page Title="Archived news" Depth="3"/>
  </Page>
</Page>

I have put this into an XML Variable called sitemap

I’m struggling with XPATH that would return the parent node of the node with the @iscurrent attribute along with its children. So from the example above, I need the following subset:

<Page Title="Communities" Depth="2">
  <Page Title="Blog" iscurrent="true" Depth="3"/>
  <Page Title="Something" Depth="3"/>
  <Page Title="Anything" Depth="3"/>
</Page>

I have tried applying this template, but nothing gets output:

<xsl:apply-templates mode="Tabs" 
        select="$sitemap/Page[@iscurrent='true']/parent/*" />

The template shouldn’t be relevant, but anyhow, here is a basic version of it:

<xsl:template mode="Tab" match="*">
  <li>
      <xsl:if test="@iscurrent = 'true'">
        <xsl:attribute name="class">current</xsl:attribute>
      </xsl:when>
    <xsl:value-of select="@MenuTitle" />
  </li>
</xsl:template>
  • 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-21T20:23:10+00:00Added an answer on May 21, 2026 at 8:23 pm

    You want something that selects the Page element having a child Page whose iscurrent attribute equals true:

    $sitemap/Page[Page[@iscurrent='true']]
    

    Demonstration:

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:variable name="sitemap" select="/Page" />
        <xsl:template match="/">
            <xsl:apply-templates select="$sitemap/Page[Page[@iscurrent='true']]" />
        </xsl:template>
        <xsl:template match="@*|node()">
            <xsl:copy>
                <xsl:apply-templates select="@*|node()" />
            </xsl:copy>
        </xsl:template>
    </xsl:stylesheet>
    

    On this input:

    <Page Depth="1">
        <Page Title="Communities" Depth="2">
            <Page Title="Blog" iscurrent="true" Depth="3" />
            <Page Title="Something" Depth="3" />
            <Page Title="Anything" Depth="3" />
        </Page>
        <Page Title="News" Depth="2">
            <Page Title="Archived news" Depth="3" />
        </Page>
    </Page>
    

    Output:

    <Page Title="Communities" Depth="2">
        <Page Title="Blog" iscurrent="true" Depth="3" />
        <Page Title="Something" Depth="3" />
        <Page Title="Anything" Depth="3" />
    </Page>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an XML structure like the following: <Root> <Base> <Greeting>Base Hello!</Greeting> <SpecialMessage>Base Special
I have an XML structure like the following: <tables> <table name=tableName1> <row ID=34 col1=data
I currently have an XML Structure that looks something like this <Parent> <Info> <Info-Data></Info-Data>
I have an XML Structure like the following: <Tickets> <EventsPoints> <Event ID=23> <PerformanceName>U2</PerformanceName> <EventDate>25/05/2012</EventDate>
Suppose I have a directory structure like the following /a/b/testB.xml /a/c/testC.xml /a/testD.xml and I
I have the following XML structure: <method constructor=true name=Main public=true> <parameterList/> <block> <call> <callAttrbute>
I have the following XML structure, and I would like to have code that:
I have an XML structure like the following <root> <person> <name>James</name> <description xsi:type=me:age>12</description> <description
I have a XML structure like the following: <Root> <Node Name=File System> <Node Name=C:\Windows\System32\drivers\etc\hosts>
I have got following xml structure of my app activity. Now I would like

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.