Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XSL: automatically wrapping text in

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 7/1/2004 5:31:00 PM

Sam Quigley wrote:


> I want to use XSL to wrap paragraphs of text in <p> tags
> automatically, basically using the heuristic that two chunks of text
> separated by 2 consecutive newlines are to be treated as two <p>s... 
> I do this right now by putting the input xml (the text to be wrapped)
> in a <paraset> tag, and using the following XSL:
> 
> <xsl:template match="paraset">
>   <xsl:call-template name="wrapinp">
>     <xsl:with-param name="input">
>       <xsl:value-of select="."/>

Here you pass in the value of a <paraset> element to the named template 
wrapinp meaning here you throw out all structure the <paraset> content 
might have and reduce it to its string value.
If you want to process <emph> elements for instance you need to make 
sure you do process text nodes and element nodes in <paraset> 
recursively with e.g. <xsl:apply-templates />.
Of course you want to split text by newlines however that is hard with 
XSLT if you have child elements as well, if possible try to fix the 
original markup to use elements to indicate the paragraph structure and 
not newlines.
I realize I have only explained what goes wrong in your current solution 
without providing a better approach with XSLT, I would start looking at
   http://www.dpawson.co.uk/xsl/sect2/sect21.html
for a solution.


-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent