Answered by:
Error in xslt formation

Question
-
User-254743730 posted
Hi,
Iam using xml to XSLT Operation. I did code . but i got only partial output... i did't get where i want to corrct my code...
my excepted output is un ordered list like this
List
- Menu1
- Menu2
Item
- lst1
- lst2
- lst3
like that.. but i got out put like this
List
menu1
List
Menu2
for contious all item will be displayed.
i ll show my xslt file
?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"/> <xsl:strip-space elements ="*"/> <xsl:template match="Menus"> <div> <xsl:if test ="Menu" ></xsl:if> <ul > <xsl:apply-templates/> </ul> </div> </xsl:template> <xsl:template match="Menu"> <li> <a> <xsl:apply-templates select="Menu"/> <xsl:attribute name="href"> <xsl:value-of select="LinkAddress"/> </xsl:attribute> <xsl:value-of select="DisplayTitle" /> </a> <xsl:for-each select="SubMenu"> <ul> <li> <a> <xsl:apply-templates select="SubMenu"/> <xsl:attribute name="href"> <xsl:value-of select="LAddress"/> </xsl:attribute> <xsl:value-of select="Title" /> </a> </li> </ul> </xsl:for-each> </li> </xsl:template> </xsl:stylesheet>
can any one tell me what is wrong..
Wednesday, September 4, 2013 1:25 PM
Answers
-
User-254743730 posted
Hi,
I found solution.
This is the solution link
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, September 5, 2013 2:51 AM
All replies
-
User1777983149 posted
Required xsl file and xml file, then use transforms merg the you will get proper result as per required, manage xsl file
Thursday, September 5, 2013 2:42 AM -
User-254743730 posted
Hi,
I found solution.
This is the solution link
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, September 5, 2013 2:51 AM -
User-573138384 posted
For the output you mentioned, you need to call the Menu template twice. First to pull only menus and second to pull submenus. You can use mode for this purpose.
<?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"/> <xsl:strip-space elements ="*"/> <xsl:template match="Menus"> <div> List<br /> <ul > <xsl:apply-templates mode="Menu"/> </ul> Item<br /> <ul > <xsl:apply-templates mode="SubMenu"/> </ul> </div> </xsl:template> <xsl:template match="Menu" mode="Menu"> <li> <a> <xsl:apply-templates select="Menu"/> <xsl:attribute name="href"> <xsl:value-of select="LinkAddress"/> </xsl:attribute> <xsl:value-of select="DisplayTitle" /> </a> </li> </xsl:template> <xsl:template match="Menu" mode="SubMenu"> <xsl:for-each select="SubMenu"> <li> <a> <xsl:apply-templates select="SubMenu"/> <xsl:attribute name="href"> <xsl:value-of select="LAddress"/> </xsl:attribute> <xsl:value-of select="Title" /> </a> </li> </xsl:for-each> </xsl:template> </xsl:stylesheet>
Thursday, September 5, 2013 2:56 AM -
User2056829991 posted
Hi
Can you put your XML data to me? May I can help you.
Best Regards
Thursday, September 5, 2013 3:06 AM