xsl-list
[Top] [All Lists]

Re: variable and html code

2003-06-27 06:16:01


 one of the input_text or addlinks  variable, gets striped of
the html tags.

Note XSLT doesn't process tags at all.
If your input_text parameter will never have any elements so I don't se
ehow it can have elements "stripped"
You didn't show your full code, but you showed it being initialised in a
template matching text() and text nodes only have text.
Again <xsl:with-param name="input_text">
                   <xsl:copy-of select="."/>
             </xsl:with-param>
would be better as
<xsl:with-param name="input_text"select="."/>
(not that it would make any difference to the result in this case)

oh there it is.. on the second ass, you do have markup the a element you
have just added.

  <xsl:with-param name="input_text">
                   <xsl:copy-of select="$addlinks"/>
              </xsl:with-param>

which would again be better using select, but either way it makes no
difference as in the end it gets passed to

         <xsl:copy-of select="substring-before($input_text, $word)"/>

substring-before expects strings as its arguments. If you give it a node
set then it takes its string value (which is just the character data
without any elements).

What you want to do is restructure your replacement as follows.
do the first word by applying these templates, storing the entire result
of teh replacement into a variable, then use your processors node-set()
extension function to convert this variable back to a node set, then
apply the templates again, this time looking for your second word
etc until you run out of words.

This would be 1000 times easier using the regexp replacement functions
available in XSLT2 so if using saxon 7 is a possibilty youmay want to
try that.

David





________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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



<Prev in Thread] Current Thread [Next in Thread>