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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:11:34+00:00 2026-06-16T21:11:34+00:00

I have a fairly simple xsl stylesheet for transforming an xml doc that defines

  • 0

I have a fairly simple xsl stylesheet for transforming an xml doc that defines our html into an html format (please don’t ask why, it’s just the way we have to do it…)

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

<xsl:template match="HtmlElement">
  <xsl:element name="{ElementType}">
    <xsl:apply-templates select="Attributes"/>
    <xsl:value-of select="Text"/>
    <xsl:apply-templates select="HtmlElement"/>
  </xsl:element>
</xsl:template>

<xsl:template match="Attributes">
  <xsl:apply-templates select="Attribute"/>
</xsl:template>

<xsl:template match="Attribute">
  <xsl:attribute name="{Name}">
    <xsl:value-of select="Value"/>
  </xsl:attribute>
</xsl:template>

The issue came up when I ran across this little bit of HTML requiring transformation:

<p>
      Send instant ecards this season <br/> and all year with our ecards!
</p>

the <br/> in the middle breaks the logic of the transformation and gives me only the first half of the paragraph block: Send instant ecards this season <br></br>. The XML attempting to be transformed looks like:

<HtmlElement>
    <ElementType>p</ElementType>
    <Text>Send instant ecards this season </Text>
    <HtmlElement>
      <ElementType>br</ElementType>
    </HtmlElement>
    <Text> and all year with our ecards!</Text>
</HtmlElement>

Suggestions?

  • 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-16T21:11:35+00:00Added an answer on June 16, 2026 at 9:11 pm

    You can simply add a new rule for Text elements and then match both HTMLElements and Texts:

    <xsl:template match="HtmlElement">
      <xsl:element name="{ElementName}">
        <xsl:apply-templates select="Attributes"/>
        <xsl:apply-templates select="HtmlElement|Text"/>
      </xsl:element>
    </xsl:template>
    
    <xsl:template match="Text">
        <xsl:value-of select="." />
    </xsl:template>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a fairly simple HTML page with a link on it that calls
I have a fairly simple dynamic html structure of a table that contains links
I have a fairly simple xml file that has an image button in it.
I have a fairly simple MFC app that just defines its own sub-classes of
I have a fairly simple python loop that calls a few functions, and writes
I have a fairly simple class that I want to save to SQL Server
I have a fairly simple spreadsheet application with some VBA code that performs simple
This is a fairly simple case. I have an xml document, linked to an
I have a fairly simple Windows Forms application that I would like to add
I have a fairly simple if else statement in C# that looks something 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.