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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:53:26+00:00 2026-05-15T05:53:26+00:00

I cannot wrap <panel> tags to second level individual items as shown in Expected

  • 0

I cannot wrap <panel> tags to second level individual items as shown in Expected result bellow. Instead I get all 1.x element values into a single node with the xslt i have written bellow. Please help me.

Source xml

    <root>
    <step id="1">
        <content>
            <text>
                1.0 Sample first level step text
            </text>
        </content>
        <content/>
        <step>
            <content>
                <text>
                    1.1 Sample second level step text
                </text>
            </content>
        </step>
        <step>
            <content>
                <text>
                    1.2 Sample second level step text
                </text>
            </content>
        </step>
        <step>
            <content>
                <text>
                    1.3 Sample second level step text
                </text>
            </content>
        </step>
    </step>
    <step id="2">
        <content>
            <text>
                2.0 Sample first level step text
            </text>
        </content>
        <content/>
        <step>
            <content>
                <text>
                    2.1 Sample second level step text
                </text>
            </content>
        </step>
        <step>
            <content>
                <text>
                    2.2 Sample second level step text
                </text>
            </content>
        </step>
        <step>
            <content>
                <text>
                    2.3 Sample second level step text
                </text>
            </content>
        </step>
    </step>
</root>

Expected output

<panel>
    <panel>
        <panel>
            1.0 Sample first level step text
        </panel>
        <panel>
            1.1 Sample second level step text
        </panel>
        <panel>
            1.2 Sample second level step text
        </panel>
        <panel>
            1.3 Sample second level step text
        </panel>
    </panel>
    <panel>
        <panel>
            2.0 Sample first level step text
        </panel>
        <panel>
            2.1 Sample second level step text
        </panel>
        <panel>
            2.2 Sample second level step text
        </panel>
        <panel>
            2.3 Sample second level step text
        </panel>
    </panel>
</panel>

My XSLT

<xsl:template match="/">
    <panel>
        <xsl:apply-templates/>
    </panel>
</xsl:template>

<xsl:template match="root/step" >
    <panel>
        <panel>
            <xsl:apply-templates select ="content/text/node()"></xsl:apply-templates>
        </panel>
        <panel>
            <xsl:apply-templates select ="step/content/text/node()"></xsl:apply-templates>
        </panel>
    </panel>
</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-15T05:53:27+00:00Added an answer on May 15, 2026 at 5:53 am

    The trick is usage // accessor

    <xsl:template match="/">
        <panel>
            <xsl:apply-templates select='//text'/>
        </panel>
    </xsl:template>
    
    <xsl:template match="text" >
            <panel>
                <xsl:apply-templates select ="./node()"></xsl:apply-templates>
            </panel>
    </xsl:template>
    

    place expected formatting instead of my node()

    EDITED
    To handle grouping as you ask, add one more

    <xsl:template match="/">
        <panel>
            <xsl:apply-templates select='/root/step' mode="root"/>
        </panel>
    </xsl:template>
    <xsl:template match="step" mode="root"><!-- mode allows distinguish another tag 'step'-->
         <panel> <!-- now we can convert tree to planar -->
             <xsl:apply-templates select='//text'/>
         </panel>    
    </xsl:template>
    
    <xsl:template match="text" >
            <panel>
                <!-- format text from node text there -->
                <xsl:apply-templates select ="text()"></xsl:apply-templates>
            </panel>
    </xsl:template>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 488k
  • Answers 488k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Easiest thing to do here to to run a function… May 16, 2026 at 8:44 am
  • Editorial Team
    Editorial Team added an answer Yes there is. It's in the second column under community.… May 16, 2026 at 8:44 am
  • Editorial Team
    Editorial Team added an answer Try something like http://jsfiddle.net/HthRD/1/ - the specifics are going to… May 16, 2026 at 8:44 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Is there an easy way to wrap a Preferences Panel thing around the Settings.settings
I have a problem that I cannot wrap my head around. I'm using Apache
I have a database issue that i currently cannot wrap my head around with
I'm porting a c++ Qt application from Windows to OSX and cannot wrap my
First, apologies,this should be simple but I've had too much coffee and cannot wrap
I'm having problems with JTables. I'm adding two tables to a panel, the tables
How can I go about creating a control that has items in item that
Is it possible to have the text in a radio button wrap itself? For
The background In .NET Windows Forms (2.0) radio buttons are automatically grouped by their
I have a FrameLayout view which contains one (MapView-like) control and some additional buttons

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.