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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:31:15+00:00 2026-06-11T22:31:15+00:00

Maybe somebody had similar problem. I need to transform using XSL the input XML

  • 0

Maybe somebody had similar problem. I need to transform using XSL the input XML file:

<decision>
    <akapit nr = 1>
           This is <b>important</b> decision for the query number <i>0123456</i>
    </akapit>
</decision>

As output I need a html document which displays text within elements <b></b> as bolded, elements in <i></i> as italic…etc. So, basically I need to format output HTML from XML element named <akapit> depending on their subelements’ names. Any idea how to use XSL template in such a case?

  • 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-06-11T22:31:16+00:00Added an answer on June 11, 2026 at 10:31 pm

    In case the markup elements names aren’t the same as the corresponding Html element names, for example:

    <decision>
        <akapit nr="1">
        This is 
            <bold>important</bold> decision for the query number
            <italic>0123456</italic>
        </akapit>
    </decision>
    

    Then a very simple application of the identity rule is this:

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:output omit-xml-declaration="yes" indent="yes"/>
     <xsl:strip-space elements="*"/>
    
     <xsl:template match="node()|@*">
         <xsl:copy>
           <xsl:apply-templates select="node()|@*"/>
         </xsl:copy>
     </xsl:template>
    
     <xsl:template match="akapit">
      <div><xsl:apply-templates/></div>
     </xsl:template>
    
     <xsl:template match="bold"><b><xsl:apply-templates/></b></xsl:template>
     <xsl:template match="italic"><i><xsl:apply-templates/></i></xsl:template>
    
     <xsl:template match="/*"><xsl:apply-templates/></xsl:template>
    </xsl:stylesheet>
    

    And when this transformation is applied on the above XML document, the wanted, correct result is produced:

    <div>
        This is 
            <b>important</b> decision for the query number
            <i>0123456</i>
    </div>
    

    Do Note: Using xsl:apply-templates should be preferred to xsl:copy-of as the latter doesn’t allow flexibility to further process the selected nodes — it only copies them.

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

Sidebar

Related Questions

maybe I will not correct explain a problem, maybe somebody help me explain this
Maybe somebody had faced with such problem? I just have tried to use Video-JS
Maybe somebody faced this kind of trouble: when using UIActionSheet on ios 5 i
Maybe somebody can help me. Starting with a CSV file like so: Ticker,Price,Market Cap
UPDATE AT THE BOTTOM Maybe somebody could help with this... been struggling with it
Maybe somebody could help me. I need a two methods. The first should open
This is a slightly obscure question, but I'm stumped and I thought maybe somebody
This may be kind of a strange question, but maybe somebody has an idea...
Maybe somebody can help me. In my project I'm using a linked list with
Maybe somebody did do this: I have several files for one font for each

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.