xml - Issue with XSLT attribute -
i'm trying transformation. far correct, xslt cannot value 1 of nodes (@curl) meanwhile node (@name) value getting correct. heres xslt:
<?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:template match="/"> <xsl:for-each select="menu/category"> <h3> <i class="icon-cube"></i> <xsl:value-of select="maincategory/@name"/> </h3> <ul class="listview fluid"> <xsl:for-each select="maincategory/subcategory"> <li> <xsl:element name="a"> <xsl:attribute name="href"> <xsl:value-of select="@curl"/> </xsl:attribute> <xsl:value-of select="@name"/> </xsl:element> </li> </xsl:for-each> </ul> </xsl:for-each> </xsl:template> </xsl:stylesheet> and xml here:
<?xml version="1.0" encoding="utf-8"?> <menu> <category> <maincategory name="Транспорт"></maincategory> </category> <category> <maincategory name="Недвижимость"> <subcategory curl="http://shop.bubaport.ru/category/1" name="Продажа"></subcategory> <subcategory curl="http://shop.bubaport.ru/category/2" name="Покупка"></subcategory> <subcategory curl="http://shop.bubaport.ru/category/3" name="Аренда"></subcategory> </maincategory> </category>
attribute names case-sensitive. in xml, have:
<subcategory curl="http://shop.bubaport.ru/category/1" name="Продажа"> but in xsl, wrote:
<xsl:value-of select="@curl"/> try changing to:
<xsl:value-of select="@curl"/>
Comments
Post a Comment