Resultant Transformation not appearing

Discussion in 'XML' started by Raghavendra RAV, Aug 25, 2004.

  1. 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
     
    Raghavendra RAV, Aug 25, 2004
    #1
    1. Advertising

  2. Raghavendra RAV

    Marrow Guest

    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


    "Raghavendra RAV" <> wrote in message
    news:...
    > 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
     
    Marrow, Aug 25, 2004
    #2
    1. Advertising

  3. 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
    <xsl:value-of select="TopMenu/@Caption" />

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


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


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Aug 25, 2004
    #3
  4. Hi,

    Both clues were perfect.

    Thanks a lot dear Marrow & Martin.

    Thanks Again,
    Raghu

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Raghavendra RAV, Aug 26, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Keith G Hicks

    resultant text height

    Keith G Hicks, Feb 14, 2008, in forum: ASP .Net
    Replies:
    0
    Views:
    266
    Keith G Hicks
    Feb 14, 2008
  2. jmhmaine
    Replies:
    0
    Views:
    293
    jmhmaine
    Jan 20, 2005
  3. jmhmaine
    Replies:
    2
    Views:
    311
    Steven Cheng[MSFT]
    Jan 21, 2005
  4. asim
    Replies:
    0
    Views:
    193
  5. Csaba  Gabor

    Textarea challenge: caret pos, resultant text

    Csaba Gabor, Apr 4, 2006, in forum: Javascript
    Replies:
    0
    Views:
    86
    Csaba Gabor
    Apr 4, 2006
Loading...

Share This Page