Subject: Re: [xsl] output unterminated tags From: jm <mailinglist@xxxxxxxxxxxxxx> Date: Sat, 5 Apr 2003 20:52:21 +0200 |
hi, this is a part of my xml-file (the table data) <table columns="3"> <cell>row1</cell> <cell>row1</cell> <cell>row1</cell> <cell>row2</cell> <cell>row2</cell> <cell>row2</cell> .... </table> and this is the part from my xslt-file so far: <xsl:template match="table"> <table border="1"> <xsl:apply-templates select="cell"/> </table> </xsl:template> <xsl:template match="cell"> <xsl:choose> <xsl:when test="position()=1"> <xsl:message><test></xsl:message> <tr> <!-- here seems to be my problem --> </xsl:when> </xsl:choose> <td> <xsl:value-of select="."/> </td> <xsl:choose> <xsl:when test="((position() mod 3) = 0) and (position()!=1) and (position() != last())"> </tr><tr> <!-- here seems to be my problem --> </xsl:when> <xsl:when test="position() = last()"> </tr> <!-- here seems to be my problem --> </xsl:when> </xsl:choose> </xsl:template> thanks, jm On Sat, 5 Apr 2003 11:50:45 -0600 bix_xslt@xxxxxxxxxxx wrote: > Jim, > > This is a common problem for those of us who have just started delving into > XML. What may be beneficial for you is if you could provide a sample XML > and XSLT sheet so that those of us on the list can show you how to work with > the XSL language. I have a feeling that you need to shift your viewpoint > from a pure html line by line thought process into a more functional > programming viewpoint. By providing the samples, we'll be able to help you > see how to use the XSL in a better manner. > > Any time you need to output a particular type of element, such as 'tr', you > want the xsl processor to create an html node or element. Using CDATA as > you have shown below creates a string that looks like a node element, but > only after the HTML has been processed (as you have seen with your output). > The way I typically do this is think about my problem in this manner: > > make the table tag, > for every row I need, > add a start tr tag, > apply all the templates for the individual td tags > end the tr tag > end the for each > end the table tag > > Hopefully that makes some sense. Again, providing the xml and xslt would > allow us to help you more. > bix > > > > > ----- Original Message ----- > From: "jm" <mailinglist@xxxxxxxxxxxxxx> > To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> > Sent: Saturday, April 05, 2003 11:38 AM > Subject: [xsl] output unterminated tags > > > > hi all, > > > > i want to output unterminated tags with my xslt-stylesheet > > for (html)table-construction. > > > > so i want to be able to print just > > > > <tr> > > or > > </tr><tr> > > or > > </tr> > > > > i tried it with <![CDATA[<tr>]]> but this put just > > > > <tr> > > > > in my html-file > > > > thanks > > jm > > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > > > > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] output unterminated tags, bix_xslt | Thread | RE: [xsl] output unterminated tags, Michael Kay |
Re: [xsl] Requesting multiple-level, W. Eliot Kimber | Date | [no subject], vikram . x . kondada |
Month |