|
next
|
 Subject: XSLT and closing tags. Author: Tom Patterson Date: 20 Oct 2004 04:25 PM
|
I am having some problems with a style sheet that I'm hoping some new eyes will be able to help. Basically, I am converting an XML document to html for screen viewing. In the element I'm dealing with now (we'll call it "wrapper"), there are two possible elements, "sentence" and "figure". There can be as many of each as they want, and in any order they want. What I need is that all of the <sentence> elements preceding a <figure> to appear in the left hand column of a two column table, with that figure in the right hand column. I also need to be able to enumerate the <sentences>. Right now, from <wrapper> I am doing:
<xsl:element name="table">
<xsl:element name="tr">
<xsl:element name="td">
<xsl:apply-templates select="sentence"/>
</xsl:element>
<xsl:element name="td">
<xsl:apply-templates select="figure"/>
</xsl:element>
</xsl:element>
</xsl:element>
Inside the sentence template, it enumerates by using:
<xsl:number count="sentence" level="single"/>
Now obviously, this doesn't work. It gives me all of the sentences in the left column (in one row), and all of the graphics in the right column (in one row), but they are not properly grouped. I wanted to be able go into the figure template and at the beginning add a </td><td> and at the end of the template, add </td></tr><tr><td> to the output, but I get parsing errors just using "</td>" and if I try "<xsl:text>%lt;/td>" I just get "<td>" appearing on the screen in the final output. I tried adding the "disable-output-escaping" attribute to the <xsl:text>, but I ended up getting </td> in the source. Does anyone have any other ideas about tackling this?
|
|
|