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 & Entertainment</Category>
<Client>Client 1</Client>
<Title>Get your Free 2</Title>
</Promotion>
<Promotion>
<Category>Arts & Entertainment</Category>
<Client>Client 1</Client>
<Title>Get your Free 4</Title>
</Promotion>
<Promotion>
<Category>Arts & Entertainment</Category>
<Client>Client 1</Client>
<Title>Get your Free 5</Title>
</Promotion>
<Promotion>
<Category>Community & 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 & 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 & 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.