|
Subject: Re: [xsl] Parsing mixed content nodes From: "Joerg Heinicke" <joerg.heinicke@xxxxxx> Date: Fri, 8 Feb 2002 22:45:21 +0100 |
the general processing:
<!-- every node, that must not be handled especially, e.g. <item>, <p> -->
<!-- this template is not needed, it's similar to built-in templates -->
<xsl:template match="*">
<xsl:apply-templates/>
</xsl:template>
<!-- <a> needs to be handled in another way -->
<xsl:template match="a">
<xsl:apply-templates/>
<xsl:text> (</xsl:text>
<xsl:value-of select="@href"/>
<xsl:text>) </xsl:text>
</xsl:template>
<!-- <br> too -->
<xsl:template match="br">
<xsl:text> </xsl:text>
</xsl:template>
For every node which must be handled, write a own template. For example the
<p>-node, if you need linebreaks:
<xsl:template match="p">
<xsl:apply-templates/>
<xsl:text> </xsl:text>
</xsl:template>
Regards,
Joerg
----- Original Message -----
From: "Jason Macki" <jmacki@xxxxxxx>
> Hello,
>
> I'm writing a stylesheet that converts some HTML code into text.
>
> For example, this xml:
>
> <item>
> <p>
> This is a <a href="link.htm">link</a><br />This is a new
> line.
> </p>
> <item>
>
> would be translated into this text:
>
> This is a link(link.htm)
> This is a new line.
>
> I can use the descendant axis to retrieve the "p" node, the "a" node,
> and the "br" node from the "item" element.
>
> My problem is combining them back together, in the correct order.
>
> I'd like to be able to write XSLT that would output:
>
> "this is a", then the "a" node, then a line break for the "br" node, and
> then output the remaining text.
>
> Does anyone have any ideas?
>
> Thanks very much,
> Jason
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Parsing mixed content nod, Thomas B. Passin | Thread | RE: [xsl] Parsing mixed content nod, Jason Macki |
| RE: [xsl] regarding javascript loop, Astor Rivera | Date | [xsl] OT Humour - "Evil Decepta-bot, Peter Elliott |
| Month |