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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:17:26+00:00 2026-05-13T19:17:26+00:00

Is there a way to turn off XSLT compile errors when creating HTML from

  • 0

Is there a way to turn off XSLT compile errors when creating HTML from an xsl stylesheet.

For instance, for every html tag is expecting a closing tag.

Now the final doc does have closing tags but it is within muliple templates where one would have the open, the last would close it. Is there a way to surpress the xslt compile error?

I am using the XslCompiledTransform Class.

my XSLT file:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 

  <xsl:output method="html" indent="yes" /> 

  <xsl:key name="categories" match="Category" use="." /> 
  <xsl:key name="client" match="Client" use="." /> 
  <xsl:key name="title" match="Title" use="." /> 

  <xsl:template match="/"> 
    <ul id="red" class="treeview-red"> 
      <xsl:for-each select="/Promotions/Promotion/Category[  
                generate-id(.) = generate-id(key('categories', .)[1])  
                ]">
      <li>
    <span>
      <xsl:value-of select="."/> 
    </span>

    <ul> 
      <xsl:call-template name="category-client"> 
        <xsl:with-param name="category" select="."/> 
      </xsl:call-template> 
    </ul>
  </li>

    </xsl:for-each>
    </ul>
  </xsl:template> 

  <xsl:template name="category-client"> 
    <xsl:param name="category" /> 
    <xsl:for-each select="/Promotions/Promotion[Category=$category]/Client[  
                generate-id(.) = generate-id(key('client', .)[1]) 
                ]">
      <li>
        <span>
          <xsl:value-of select="."/>
        </span>

        <ul>


          <xsl:call-template name="category-client-title">
            <xsl:with-param name="category" select="$category"/>
            <xsl:with-param name="client" select="."/>
          </xsl:call-template>


        </ul>
      </li>
    </xsl:for-each> 
  </xsl:template> 

  <xsl:template name="category-client-title"> 
    <xsl:param name="category" /> 
    <xsl:param name="client" /> 
    <xsl:for-each select="/Promotions/Promotion[Category=$category]/Title[  
                generate-id(.) = generate-id(key('title', .)[1]) 
                ]"> 
      <li> 
    <span> 
      <xsl:value-of select="."/> 
    </span> 
      </li> 

    </xsl:for-each> 
  </xsl:template> 

</xsl:stylesheet> 

My XML:

<Promotions> 
  <Promotion> 
    <Category>Arts &amp; Entertainment</Category> 
    <Client>Client 1</Client> 
    <Title>Get your Free 2</Title> 
  </Promotion> 
  <Promotion> 
    <Category>Arts &amp; Entertainment</Category> 
    <Client>Client 1</Client> 
    <Title>Get your Free 4</Title> 
  </Promotion> 
  <Promotion> 
    <Category>Arts &amp; Entertainment</Category> 
    <Client>Client 1</Client> 
    <Title>Get your Free 5</Title> 
  </Promotion> 
  <Promotion> 
    <Category>Community &amp; Neighborhood</Category> 
    <Client>Client 2</Client> 
    <Title>Get your Free 1</Title> 
  </Promotion> 
  <Promotion> 
    <Category>Education</Category> 
    <Client>Client 3</Client> 
    <Title>Get Your Free 3</Title> 
  </Promotion> 
</Promotions> 

I would like the output structured like this:

<ul id='red' class='treeview-red'>
 <li><span>Item 1</span>
  <ul>
   <li><span>Item 1.0</span>
    <ul>
     <li><span>Item 1.0.0</span></li>
    </ul>
   </li>
   <li><span>Item 1.1</span></li>
   <li><span>Item 1.2</span>
    <ul>
     <li><span>Item 1.2.0</span>
     <ul>
      <li><span>Item 1.2.0.0</span></li>
      <li><span>Item 1.2.0.1</span></li>
      <li><span>Item 1.2.0.2</span></li>
     </ul>
    </li>
     <li><span>Item 1.2.1</span>
     <ul>
      <li><span>Item 1.2.1.0</span></li>
     </ul>
    </li>
     <li><span>Item 1.2.2</span>
     <ul>
      <li><span>Item 1.2.2.0</span></li>
      <li><span>Item 1.2.2.1</span></li>
      <li><span>Item 1.2.2.2</span></li>
     </ul>
    </li>
    </ul>
   </li>
  </ul>
 </li>
 <li><span>Item 2</span>
  <ul>
   <li><span>Item 2.0</span>
    <ul>
     <li><span>Item 2.0.0</span>
     <ul>
      <li><span>Item 2.0.0.0</span></li>
      <li><span>Item 2.0.0.1</span></li>
     </ul>
    </li>
    </ul>
   </li>
   <li><span>Item 2.1</span>
    <ul>
     <li><span>Item 2.1.0</span>
     <ul>
      <li><span>Item 2.1.0.0</span></li>
     </ul>
    </li>
     <li><span>Item 2.1.1</span>
     <ul>
      <li><span>Item 2.1.1.0</span></li>
      <li><span>Item 2.1.1.1</span></li>
      <li><span>Item 2.1.1.2</span></li>
     </ul>
    </li>
     <li><span>Item 2.1.2</span>
     <ul>
      <li><span>Item 2.1.2.0</span></li>
      <li><span>Item 2.1.2.1</span></li>
      <li><span>Item 2.1.2.2</span></li>
     </ul>
    </li>
    </ul>
   </li>
  </ul>
 </li>
 <li class='open'><span>Item 3</span>
  <ul>
   <li class='open'><span>Item 3.0</span>
    <ul>
     <li><span>Item 3.0.0</span></li>
     <li><span>Item 3.0.1</span>
     <ul>
      <li><span>Item 3.0.1.0</span></li>
      <li><span>Item 3.0.1.1</span></li>
     </ul>

    </li>
     <li><span>Item 3.0.2</span>
     <ul>
      <li><span>Item 3.0.2.0</span></li>
      <li><span>Item 3.0.2.1</span></li>
      <li><span>Item 3.0.2.2</span></li>
     </ul>
    </li>
    </ul>
   </li>
  </ul>
 </li>
 </ul>";

to use in this control:

like sample 2:

http://jquery.bassistance.de/treeview/demo/

my current results, close but not right yet:

        <ul id="red" class="treeview-red">
  <li><span>Arts &amp; Entertainment</span><ul>
      <li><span>Client 1</span><ul>
          <li><span>Get your Free 2</span></li>
          <li><span>Get your Free 4</span></li>
          <li><span>Get your Free 5</span></li>
        </ul>
      </li>
    </ul>
  </li>
  <li><span>Community &amp; Neighborhood</span><ul>
      <li><span>Client 2</span><ul>
          <li><span>Get your Free 1</span></li>
        </ul>
      </li>
    </ul>
  </li>
  <li><span>Education</span><ul>
      <li><span>Client 3</span><ul>
          <li><span>Get Your Free 3</span></li>
        </ul>
      </li>
    </ul>
  </li>
</ul>

If I could close this tag at the end

</ul> 

Then it would be fine, but when I try I get error.

  • 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-13T19:17:26+00:00Added an answer on May 13, 2026 at 7:17 pm

    This is a common question on the xsllist forum. But the answer is no.

    When using XSLT, you cannot think serially of emitted “tags” but instead you have to think of writing elements and their content. So you don’t start here, and end there, but you have to open and close together and call elsewhere for the intervening content.

    It’s a hard concept to grasp; at first it’s like writing code while standing on your head.

    If you have an example, it would be easier to help.

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

Sidebar

Ask A Question

Stats

  • Questions 492k
  • Answers 492k
  • 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 array_walk_recursive() should work, but it modifies the array you pass… May 16, 2026 at 10:27 am
  • Editorial Team
    Editorial Team added an answer If all you want is just to be able to… May 16, 2026 at 10:27 am
  • Editorial Team
    Editorial Team added an answer The "isUnique" rule looks for repeating values in other rows.… May 16, 2026 at 10:27 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 a way to turn off multithreading or limit the number of cores
Is there any way to turn off all console.log statements in my JavaScript code,
Is there a way to turn off intellisense in Visual Studio 2008? I know
Is there a way to turn off debug logging for just dozer? At least
Is there a way to turn off the automatic selection of the first row
Is there any way to turn off antialias for all text in a plot,
Is there a way to turn off SSL checking so that WrongHost Exceptions are
Is there a way to turn off auto-complete on an input-field using jQuery? Like
I am passing a optionLabel into the Html.DropDownList helper (taken from this SO question):
Is there a way to supress WPF tool tips, other than by setting their

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.