• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

xslt beginner

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi folks,
I'm totally new to xml,xslt and the related technologies. I've a small xml file and .xsl file, but something seems to be wrong, am not getting the desired output. Can someone point out wat mistake am doing?
xml file is :

My .XSL file is

The output i get is

I was hoping to get

Pointers??
TIA
Rex
 
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Try this
<xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'><xsl:template match="/">
<TABLE BORDER="1">
<TR>
<TH>Author</TH>
<TH>School</TH>
</TR>
<xsl:for-each select="//one">
<TR>
<TD>
<xsl:value-of select="Author"/>
</TD>
<TD>
<xsl:value-of select="School"/>
</TD>
</TR>
</xsl:for-each>
</TABLE>
</xsl:template>
</xsl:stylesheet
This should get you what you need. From the root level you are looking for <one>which could have zero or more elements in between and then you select author and school for each.
Later,
Hema
reply
    Bookmark Topic Watch Topic
  • New Topic