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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:17:48+00:00 2026-05-18T11:17:48+00:00

The problem is that in the XSLT doc below, all my hrow tags are

  • 0

The problem is that in the XSLT doc below, all my hrow tags are at the bottom, I want it to maintain the order in which they appear, how do I do that?

my xml doc

<log>
<hrow time="45:43:2343">A heading</hrow>
<row type="e">An error</row>
<row type="w">An warn</row>
<row type="i">An info</row>
<row type="d">An debug</row>
<row type="t">unknown</row>
<hrow time="45:43:2343">Another heading</hrow>
<row type="t">more rows</row>
</log>

the xslt doc

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
        <table width="100%">
            <xsl:apply-templates />
        </table>
    </xsl:template>

    <xsl:template match="log">
            <xsl:apply-templates select="row" />
            <xsl:apply-templates select="hrow" />
    </xsl:template>

    <xsl:template match="row">
        <xsl:variable name="type" select="@type" />
        <xsl:choose>
            <xsl:when test="$type = 'd'">
                <tr>
                    <td style="background-color:#C6F98B">
                        <xsl:value-of select="." />
                    </td>
                </tr>
            </xsl:when>
            <xsl:when test="$type = 'i'">
                <tr>
                    <td style="background-color:#8B8BF9">
                        <xsl:value-of select="." />
                    </td>
                </tr>
            </xsl:when>
            <xsl:when test="$type = 'e'">
                <tr>
                    <td style="background-color:#F9555D">
                        <xsl:value-of select="." />
                    </td>
                </tr>
            </xsl:when>
            <xsl:when test="$type = 'w'">
                <tr>
                    <td style="background-color:#F8F781">
                        <xsl:value-of select="." />
                    </td>
                </tr>
            </xsl:when>
            <xsl:otherwise>
                <tr>
                    <td style="background-color:#E4E4E4">
                        <xsl:value-of select="." />
                    </td>
                </tr>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <xsl:template match="hrow">
        <tr>
            <td style="background-color:#DBC5FF;font-size: 16px;">
                <xsl:value-of select="." />
                [
                <xsl:value-of select="@time" />
                ]
            </td>
        </tr>
    </xsl:template>

</xsl:stylesheet>
  • 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-18T11:17:48+00:00Added an answer on May 18, 2026 at 11:17 am

    With the posted XML document, instead of

    <xsl:template match="log">
            <xsl:apply-templates select="row" />
            <xsl:apply-templates select="hrow" />
    </xsl:template>
    

    simply do

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

    that processes all child nodes of the log element in document order.

    Or if you have other child nodes not shown but which you don’t want to process then use

    <xsl:template match="log">
            <xsl:apply-templates select="row | hrow"/>
    </xsl:template>
    

    that way the selected elements (i.e. row and hrow) are processed in document order too.

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

Sidebar

Related Questions

The problem is, that my XSLT-Transformation process ( called by .NET ), doesn't leave
Seems to be a problem that many people have, but all the answers I
I want make a xslt transformation to xsl-fo but I´m not really sure that
I'm new to xslt, and I fear that this problem hinges on me getting
I have following problem that in a transformation (which is completely done in memory)
So, I know you can't access variables outside scope, that they're immutable, that XSLT
Simple problem that I can't figure out... How can I print a '%' character
The problem that I have is somehow very specific. I have to implement a
I have a problem that I'm working on for quite some time now. I
Here is a problem that has been bothering me a lot about Python, I

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.