I am using the following code to transform my XML. But it's not reproducing results.
My XML:
<items>
<Books>
<Book ItemId="BK000023">
<Name>Book Name 1</Name>
<Group GroupID="BG3434344" HomeGroupInd="1">
<Name>Home Group</Name>
</Group>
</Book>
<Book ItemId="BK000024">
<Name>Book Name 1</Name>
<Group GroupID="BG343555" HomeGroupInd="2">
<Name>Home Group</Name>
</Group>
</Book>
</Books>
</items>
My XSL:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes" encoding="UTF-8"/>
<xsl:template match="/">
<MyList>
<xsl:for-each select="items/Books/Book">
<Item>
<xsl:attribute name="ID">W<xsl:value-of select="@WorkAreaID"/>
</xsl:attribute>
<xsl:attribute name="Tag">W</xsl:attribute>
<xsl:attribute name="Thumb">11</xsl:attribute>
<xsl:attribute name="Pic">24</xsl:attribute>
<Text>
<xsl:value-of select="Name"/>
</Text>
</Item>
</xsl:for-each>
</MyList>
</xsl:template>
</xsl:stylesheet>
My Classic ASP code:
<%
Dim objXML
Dim objXSL
Dim strXMLFileName
Dim strXSLFile
Dim strHtml
strXMLFileName=Server.MapPath("test.xml")
strXSLFile=Server.MapPath("eyb.xsl")
set objXML = Server.CreateObject("Microsoft.XMLDOM")
objXML.async = false
objXML.load(strXMLFile)
set objXSL = Server.CreateObject("Microsoft.XMLDOM")
objXSL.async = false
objXSL.load(strXSLFile)
strHtml = objXML.transformNode(objXSL)
Response.Write( server.HTMLEncode( strHtml))
set objXML = nothing
set objXSL = nothing
%>
My Result is always like <MyList></MyList>
XSL is not looping the XML nodes. If I use the same XML and XSL in any online sites or any tools to transform the XML then it's giving expected results. What am I doing wrong here?