Resultant Transformation not appearing

R

Raghavendra RAV

Hi,

My Xml and Xsl files are included here...
On executing my xml file, i am not getting anything in my browser..
my browser shows blank..
please give me some solution or point where the problem is..

---------------xml file------------------------------------------------

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="MenuRender.xsl"?>

<TopMenu Caption="Links">
<Menu Type="SubMenu" Caption="Cybernet">
<Menu Type="MenuItem" href="http://cybernetsoft.com">
Cybernet Software Systems
</Menu>

<Menu Type="MenuItem" href="http://11.1.15.10">
Time Sheet
</Menu>
</Menu>

<Menu Type="SubMenu" Caption="Slash Support">
<Menu Type="MenuItem" href="http://slashsupport.com">
Slash Homepage
</Menu>

<Menu Type="MenuItem" href="http://24carats.slashsupport.com">
24 Carats Program
</Menu>
</Menu>

<Menu Type="MenuItem" href="http://readytestgo.com">
RTG Homepage
</Menu>
</TopMenu>

----------------------end of xml------------------------------------

-----------------------xsl file--------------------------------------

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<!-- <xsl:param name="CurrentPage">CurrentPage</xsl:param>
<xsl:param name="MenuId">1</xsl:param> -->

<xsl:template match="/">
<HTML>
<BODY>
<table width="100px" border="0px" cellspacing="0px" cellpadding="0px">
<TR>
<TD class="MenuTitleBar">
<xsl:value-of select="@Caption"/>
</TD>
</TR>
<xsl:for-each select="Menu">
<xsl:choose>
<xsl:when test="@Type='SubMenu'">
<TR>
<TD class="SubMenu">
<xsl:value-of select="text()" />
</TD>
</TR>
<xsl:for-each select="Menu">
<TR>
<TD class="MenuItem">
<A>
<xsl:attribute name="href">
<xsl:value-of select="href" />
</xsl:attribute>
<xsl:value-of select="text()"/>
</A>
</TD>
</TR>
</xsl:for-each>
</xsl:when>
<xsl:eek:therwise>
<TR>
<TD class="MenuItem">
<A>
<xsl:attribute name="href">
<xsl:value-of select="href" />
</xsl:attribute>
<xsl:value-of select="text()"/>
</A>
</TD>
</TR>
</xsl:eek:therwise>
</xsl:choose>
</xsl:for-each>
</table>
</BODY>
</HTML>
</xsl:template>

</xsl:stylesheet>
------------------------end of xsl file-----------------------

I am a newbie to xml. Please excuse me if there are silly mistakes.

Thanks,
Raghu
 
M

Marrow

Hi,

You are getting a result - it just doesn't have much that will be visibly
noticeable.

Your problem is...

<xsl:for-each select="Menu">

but at that point your context node is the document root node (not the
document root element) - because you are in the template... <xsl:template
match="/">

If you change...
<xsl:template match="/">
to...
<xsl:template match="TopMenu">

Or if you change...
<xsl:for-each select="Menu">
to...

<xsl:for-each select="TopMenu/Menu">

then you should start to see some results.

HTH
Marrow
http://www.marrowsoft.com - home of Xselerator (XSLT IDE and debugger)
http://www.topxml.com/Xselerator
 
M

Martin Honnen

Raghavendra RAV wrote:

My Xml and Xsl files are included here...
On executing my xml file, i am not getting anything in my browser..
my browser shows blank..
please give me some solution or point where the problem is..

---------------xml file------------------------------------------------

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="MenuRender.xsl"?>

<TopMenu Caption="Links">
<Menu Type="SubMenu" Caption="Cybernet">
<Menu Type="MenuItem" href="http://cybernetsoft.com">
Cybernet Software Systems
</Menu>

<Menu Type="MenuItem" href="http://11.1.15.10">
Time Sheet
</Menu>
</Menu>

<Menu Type="SubMenu" Caption="Slash Support">
<Menu Type="MenuItem" href="http://slashsupport.com">
Slash Homepage
</Menu>

<Menu Type="MenuItem" href="http://24carats.slashsupport.com">
24 Carats Program
</Menu>
</Menu>

<Menu Type="MenuItem" href="http://readytestgo.com">
RTG Homepage
</Menu>
</TopMenu>

----------------------end of xml------------------------------------

-----------------------xsl file--------------------------------------

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<!-- <xsl:param name="CurrentPage">CurrentPage</xsl:param>
<xsl:param name="MenuId">1</xsl:param> -->

<xsl:template match="/">
<HTML>
<BODY>
<table width="100px" border="0px" cellspacing="0px" cellpadding="0px">
<TR>
<TD class="MenuTitleBar">
<xsl:value-of select="@Caption"/>

Use
</TD>
</TR>
<xsl:for-each select="Menu">

Try
<xsl:for-each select="TopMenu/Menu">
 
R

Raghavendra RAV

Hi,

Both clues were perfect.

Thanks a lot dear Marrow & Martin.

Thanks Again,
Raghu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top