Active
Project:
Import HTML
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
11 Dec 2013 at 09:07 UTC
Updated:
11 Dec 2013 at 09:10 UTC
Jump to comment: Most recent
Hi all,
I'm trying to create a custom xsl template from html2simplehtml.xsl.
Basically, the requirement is to get the node body without html tags.
Currently my import is working fine with html2simplehtml.xsl template.
here is an example of the node body from the import:
<!--Couldn't selectively extract content, Imported Full Body :( May need to used a more carefully tuned import template.-->
<div class="container-narrow">
<div class="masthead">
<ul class="nav nav-pills pull-right">
<li class="active">
<a href="/index.html">Home</a>
</li>
<li>
<a href="/apps.html">Applications</a>
</li>
<li>
<a href="/middleware.html">Middleware</a>
</li>
Now, the requirement is to only get:
Home
Applications
Middleware
I have found this XSL to remove html tags:
<!-- This will remove the tag -->
<xsl:template name="remove-html">
<xsl:param name="text"/>
<xsl:choose>
<xsl:when test="contains($text, '<')">
<xsl:value-of select="substring-before($text, '<')"/>
<xsl:call-template name="remove-html">
<xsl:with-param name="text" select="substring-after($text, '>')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>but I am not sure where to put and how to call it using this:
<!-- Calling the template that removes tag -->
<xsl:call-template name="remove-html">
<xsl:with-param name="text" select="{HtmlBody}"/>
</xsl:call-template>
and also, Im suppose to put a valid value for:
<xsl:with-param name="text" select="{HtmlBody}"/>
{HtmlBody} is just a sample.
the rest of my custom xsl is exactly the same as html2simplehtml.xsl
Can anyone help me with this?
Thank you,
S.
Comments
Comment #1
sigit.k commented