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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:43:45+00:00 2026-05-23T02:43:45+00:00

I would like to apply a XSL template to a portion of the XML

  • 0

I would like to apply a XSL template to a portion of the XML and copy the rest unmodified in the result XML.

For the time being I’m doing something that works.

<xsl:template match="yt:bold">
  <xsl:choose>
       <xsl:when test="ancestor::ReportContent"> //I keep the ReportContent unchanged
            <xsl:copy><xsl:copy-of select="@*"/>
                 <xsl:apply-templates />
            </xsl:copy>
       </xsl:when>
       <xsl:otherwise>
        <b>
              <xsl:apply-templates />
            </b>
       </xsl:otherwise>
  </xsl:choose>
</xsl:template>

But I’m doing this for each template… and I am sure there is a more elegant way to do this.

I tried to copy portion of the XML using this template:

<xsl:template match="ReportContent">
<xsl:copy><xsl:copy-of select="@*"/><xsl:apply-templates select="???" /></xsl:copy>
 </xsl:template>

But I apply all the other templates when copying… and I don’t want that.

So is there a more elegant way to do what I want to do?

Thanks in advance.

  • 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-23T02:43:45+00:00Added an answer on May 23, 2026 at 2:43 am

    Is this what you’re trying to do?

    <xsl:template match="yt:bold[not(ancestor::ReportContent)]">
      <b>
        <xsl:apply-templates />
      </b>
    </xsl:template>
    

    Or perhaps

    <xsl:template match="ReportContent">
      <xsl:copy-of select="."/>
    </xsl:template>
    

    ?

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

Sidebar

Related Questions

<xsl:apply-templates select=element[child='Yes']> Works fine but I would like to use <xsl:apply-templates select=element[$childElementName='Yes']> so I
I have XSLT 1.0 like this: <?xml version=1.0?> <xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform version=1.0> <xsl:template match=paragraph> <p>
I would like to apply transition rules to elements with javascript, so far this
I would like to apply successive animations (say ScaleAnimation) to an ImageView showing a
I would like to apply FileIOPermission on set of files using mask in file
I would like to apply a css file after choosing an option from a
I would like to apply a background-color style conditionally in the itemTpl of a
I would like to apply CSS styles to links that appear in column headers
I am using TortoiseHg and would like to apply a hook to my repo.
I have a dataframe and I would like to apply a function that takes

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.