Re: [xsl] How do insert after a line break but before the next text element?

Subject: Re: [xsl] How do insert after a line break but before the next text element?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 11 Jun 2002 16:56:51 +0100
> How would I make that appear on the  next line?
lots of ways:-) depending on what the full spec is.

the thing to note is that your template for  Synopsis
does <xsl:apply-templates /> so applies templates to element and text
nodes.

You haven't any templates for text nodes so the default one fires, which
just puts the text nodes straight through. This is why you get |
straight after the result of applying templates to <var>tag</var>

so.. if you always want text nodes that have string value "|" to start a
new line then that's

<xsl:template match="text()[.='|']">
|</xsl:template>

If you want any string nodes starting with | to start on a new line then
that's

<xsl:template match="text()[starts-with(.,'|')]">
 <xsl:text>&#10;</xsl:text>
 <xsl:value-of select="."/>
</xsl:template>

If you only want to do that of it starts with | and the preceding node
was a var then ...



<xsl:template match="text()[starts-with(.,'|') and preceding-sibling::node()[1][self::var]]">
 <xsl:text>&#10;</xsl:text>
 <xsl:value-of select="."/>
</xsl:template>


> 2. I'd like to insert characters at the beginning of the line with 
> "[-from]" or the pipe
> that I break onto the next line.

sorry, I couldn't parse this one.

David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread