Re: Newbie - Help with transformation
- From: "Rey" <reycollazo@xxxxxxx>
- Date: Sat, 25 Jun 2005 11:14:12 -0700
Howdy, Joris.
Thanks for the quick help.
You were correct in that there were 2 Item template matches - can't see the
forest for the trees 8-). Fixing that displayed the table frame or should I
say 3 table headers.
Then, I changed the apply template in the root section to Root/Item with a
coresponding change from Root match to Item match. This then caused the 3
rows to display in the table. However, the ItemID and SectionDescription
data does not display.
Thanks again for the help as now I at least "see" data 8-),
Rey
"Joris Gillis" <roac@xxxxxxxxxx> wrote in message
news:op.ssxq7bt5yf9v9r@xxxxxxxxxxxxxxxxxx
> Hi,
>
> > When I started this yesterday, I got 3 header displays but no table
frame;
> > made a change then got the 3 ItemID numbers but all in a row w/no
separation
> > and still no table frame.
> > Had tried using the apply-templates meth for the table data fields with
> > matching templates but no success. Then tried using value-of - still no
> > success.
>
> I think the stylesheet you need looks something like this:
> <?xml version="1.0" encoding="utf-8"?>
> <xsl:stylesheet
> version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>
> <xsl:output method="html" indent="yes"/>
>
> <!-- applied to root node of xml document -->
> <xsl:template match="/">
> <!-- output to html -->
> <html>
> <head>
> <title>Test Output - Answers to Certification Exam
Questions</title>
> </head>
> <body bgcolor="white">
> <!--   is for non-breaking space -->
> <!-- get/display test name -->
> <p><b>Test Name:  </b><xsl:value-of
> select="Root/@TestName"/></p>
> <xsl:apply-templates select="Root"/>
> </body>
> </html>
> </xsl:template>
>
>
> <xsl:template match="Root">
> <table width="100%" border="1" >
> <tr><th>ItemID</th><th>Question</th><th>Answer</th><th>Section
> Description</th></tr>
> <!-- loop thru each Q & A -->
> <xsl:for-each select="Item">
> <tr>
> <td><xsl:value-of select="@ItemID"/></td>
> <td><xsl:value-of select=".//div"/></td>
> <td><xsl:value-of select=".//label"/></td>
> <td><xsl:value-of select=".//SectionDescription"/></td>
> </tr>
> </xsl:for-each>
> </table>
> </xsl:template>
>
>
> <xsl:template match="@ItemID"><b><xsl:value-of
select="."/></b></xsl:template>
>
> </xsl:stylesheet>
>
> the reason for the table not being setup was that you had two template
that match the 'Item' node.
>
> Hope this helps.
>
> regards,
> --
> Joris Gillis (http://users.telenet.be/root-jg/me.html)
> Vincit omnia simplicitas
> Keep it simple
.
- References:
- Newbie - Help with transformation
- From: Rey
- Re: Newbie - Help with transformation
- From: Joris Gillis
- Newbie - Help with transformation
- Prev by Date: Re: XSLT Scripting Question
- Next by Date: rss feed repository or directory
- Previous by thread: Re: Newbie - Help with transformation
- Next by thread: XSLT Scripting Question
- Index(es):
Relevant Pages
|