xsl-list
[Top] [All Lists]

Re: [xsl] XHTML Link stripping

2006-11-29 06:19:56

You can add the following template in an identity transform (search the web for what that is)

<xsl:template match="a">
   <xsl:apply-templates />
</xsl:template>

Peter Hollas wrote:

Hi everyone,

Please could someone provide an example stylesheet of how to strip <a>
link tags out of a source XHTML document whilst retaining the
remaining node text from within the body. Preferably the output should
have normalised whitespace and a space seperating each extracted piece
of text. eg.

Source:

<html>
<head>
<title>Not wanted</title>
</head>
<body>
<a>Not wanted</a>
<div class="1">This text is wanted <a href="#">Not wanted</a> and so
is this</div>
<p>Wanted</p>
</body>
</html>


Output:

<htmltext>This text is wanted and so is this Wanted</htmltext>

I'm sure that the solution is incredibly simple, but after days of
trying I keep hitting a brick wall.

Many thanks, Peter.

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

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