This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: How does one go about extracting HTML anchors from an XML file?


On Mon, 17 Sep 2001, Liat Jacob wrote:

[...]

> Here's the XML file:
>
> <article>
>    <summary>
>       <p>blah blah blah blah blah blah
>          blah <href link='www.yahoo.com'> some link text here</href>blah
> 	 blah blah <a mailto="jacob_liat@hotmail.com>some text here</a>
> 	 blah blah.</p>
>       <p>second paragraph with additional anchors embedded
>          throughout the paragraph text.</p>
>    </summary>
> </article>
>
> I want the HTML to look like this:
>
> <P>blah blah blah blah blah blah blah <A HREF="http://www.yahoo.com";> some
> link text here</A> blah blah blah <A HREF="mailto:jacob_liat@hotmail.com";>
> some text here</A> blah blah blah.</P>
>
> <P>second paragraph with additional anchors embedded throughout the
> paragraph text.</P>

How about:

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

<xsl:template match="href">
  <A HREF="{@link}"><xsl:apply-templates/></A>
</xsl:template>

<xsl:template match="a">
  <A HREF="mailto:{@mailto}";><xsl:apply-templates/></A>
</xsl:template>

(this is untested, but Should Work(TM))

Hope this helps.

--Swen



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]