<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" > <xsl:output method="xml" indent="yes" encoding="utf-8"/> <xsl:template match="/Menus"> <ul> <xsl:call-template name="MenuListing" /> </ul> </xsl:template> <!-- Allow for recusive child node processing --> <xsl:template name="MenuListing"> <xsl:apply-templates select="Menu" /> </xsl:template> <xsl:template match="Menu"> <li> <a> <!-- Convert Menu child elements to <li> <a> html tags and add attributes inside <a> tag --> <xsl:attribute name="href"> <xsl:value-of select="url"/> </xsl:attribute> <xsl:value-of select="name"/> </a> <input> <xsl:attribute name="id"> <xsl:value-of select="menuid"/> </xsl:attribute> <xsl:attribute name="type"> <xsl:text>checkbox</xsl:text> </xsl:attribute> <xsl:attribute name="class"> <xsl:text>selectCat</xsl:text> </xsl:attribute> <xsl:attribute name="checked"> <xsl:value-of select="IsChecked"/> </xsl:attribute> </input> <!-- Call MenuListing if there are child Menu nodes --> <xsl:if test="count(Menu) > 0"> <ul> <xsl:call-template name="MenuListing" /> </ul> </xsl:if> </li> </xsl:template> </xsl:stylesheet>
<xsl:if test="Menu/checked='True'" xmlns:xsl="#unknown"> <xsl:attribute name="checked"> <xsl:value-of select="IsChecked" /> </xsl:attribute> </xsl:if>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)