[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] Re: XSL issue
Subject: Re: [xsl] Re: XSL issue
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Fri, 7 Jul 2006 10:53:56 +0530
|
Hi Prashanth,
You need to do following..
First write a identity template (to copy everything):
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*" />
</xsl:copy>
</xsl:template>
Now write different templates for various cases:
<xsl:template match="body">
<body>
<chunk>
<xsl:apply-templates />
</chunk>
</body>
</xsl:template>
<xsl:template match="a">
<xsl:choose>
<xsl:when test="contains(@href, '.com') or contains(@href, '.net')">
<ulink url="{@href}" />
</xsl:when>
<xsl:otherwise>
<link linkend="{@href}" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Regards,
Mukul
On 7/7/06, Prashanth T S <tsprashanth@xxxxxxxxx> wrote:
>
> Hi,
>
> I have an input xhtml file. There are a couple of things I need to
> do to this file
>
> 1) Between the <body>......................</body> tags, I
> need to add my own custom tag like
> <body><chunk>................</chunk></body>.
>
> 2) If I have a <a href="xyz"> </link>then I need to replace a with link,
> href with linkend.Basically this should become
> <link linkend="xyz"></link>.
>
> Also, if the link is referring to an external link, like
> http://www.google.com, then instead of link I must put ulink i.e.,
> <ulink url=http://www.google.com> </ulink>
>
> Please let me know if there is a solution for the above. This is very urgent
> and any help would be highly appreciated.
>
> Thanks
> Prashanth
|