Subject: RE: [xsl] output unterminated tags From: "Michael Kay" <mhk@xxxxxxxxx> Date: Sat, 5 Apr 2003 21:31:18 +0100 |
This is the standard problem of arranging data in multiple columns, you will find the answer at http://www.dpawson.co.uk/xsl/sect2/N7450.html#d7608e13 Michael Kay Software AG home: Michael.H.Kay@xxxxxxxxxxxx work: Michael.Kay@xxxxxxxxxxxxxx > -----Original Message----- > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of jm > Sent: 05 April 2003 19:52 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: Re: [xsl] output unterminated tags > > > 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 > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] output unterminated tags, jm | Thread | RE: [xsl] output unterminated tags, Michael Kay |
[xsl] RE: selecting a template dyna, Michael Kay | Date | Re: [xsl] ID of HTML control must h, David Carlisle |
Month |