• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

XSL Problem

Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Folks!

I have an xml doc which I want to render as HTML.

with the following xsl..

Here the html output only has the id value and nothing else.

How do I use a template to match the sub-root element and display its id and use a different template to match its child nodes.

Anyone who can help me out here???

Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'm also a new to xsl-xml but i think u should use...

<xsl:for-each select="//root/sub-root">
<xsl:value-of select="name"/>

coz for me it worked fine
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
<xsl utput method="html"/>

<xsl:template match="/">

<xsl:template match="sub-root">
<i><xsl:value-of select="@id" /></i>


<xsl:template match="sub-root/node1"> <!-- This never executes. -->
<b><xsl:value-of select="." /></b>

<xsl:template match="sub-root/node2"> <!-- Neither does this -->
<h2><xsl:value-of select="." /></h2>

but this is not the good solution. You need to tell us your exact requirement.
I’m tired of walking, and will rest for a minute and grow some wheels. This is the promise of this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic