Creating HTML tags through XSL.

THOMAS PASSIN tpassin at idsonline.com
Tue Feb 1 02:32:03 GMT 2000


The "</TABLE/>" tag is not legal in xml or html.  "<TABLE BORDER="0"/>" is
also not what you want, because it ends the TABLE tag right there.

Before asking how to write xslt code, you should write an example of the
html that you want to produce from an example of the source xml.  Test it,
and when the html is working, THEN you can start to work on the xslt.

You can count with <xsl:number/>, you can set variables with with
xsl:variable, and you can get the current position with position().  Between
these, you ought to be able to do what you want.

Tom Passin

 <prasadm at crt.com> wrote:
>
> Thanks for your time. I have tried what you have suggested and that works
> fine.
> But what I am trying to do is.
>
> <xsl:template match="ROW">
>   <xsl:choose>
>   <xsl:when test="position()=0">
> <TABLE BORDER="0"/>
> <xsl:apply-templates/>
>   </xsl:when>
>   <xsl:when test="position() div 10 = 1">
> </TABLE/>
>   </xsl:when>
>   <xsl:otherwise>
> <xsl:apply-templates/>
>   </xsl:otherwise>
>   </xsl:choose>
> </xsl:template>
>
> Since the parser was giving an error on the </TABLE/> line, I tried using
> &lt;/TABLE/&gt;
> but this tag would appear on the browser rather than being interpreted as
a
> markup.
> Is there any other way of accomplishing this, I wanted to know.
>
> Thanks in advance for the help.
>
> Another simple question, is it possible to add a node in an XML document
at
> some reqular intervals.
> like. For eg: Say, I have a XML doc. with 400 rows. I want to insert a
> <LAYER></LAYER>
> tag between every 20 documents. The XML doc. after the insertion should
look
> like this.
>
> <ROWSET>
> <LAYER num="1">
> <ROW id="1">
> ......
> </ROW>
> <ROW id="2">
> ......
> </ROW>
> <ROW id="3">
> ......
> </ROW>
> ....
> ...
> <ROW id="20">
> ......
> </ROW>
> </LAYER>
> <LAYER num="2">
> ....
> .....
> </LAYER>
> </ROWSET>
>
> How can this be done? If anyone has a sample code, it would
> be helpful.
>
>
> -- Prasad
>
>


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ or CD-ROM/ISBN 981-02-3594-1
Please note: New list subscriptions and unsubscriptions
are  now ***CLOSED*** in preparation for list transfer to OASIS.





More information about the Xml-dev mailing list