[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: How does one go about extracting HTML anchors from

Subject: RE: How does one go about extracting HTML anchors from an XML file?
From: "Hewko, Doug" <Doug.Hewko@xxxxxxxxxxxxxxx>
Date: Mon, 17 Sep 2001 15:25:10 -0400
extracting html from xml
try:
<xsl:template name="href">
   <xsl:param name="word"/>
	<a>
	<xsl:attribute name="href">
		<xsl:value-of select="$word"/>
	</xsl:attribute>
	</a>
</xsl:template>

and

<xsl:template name="a">
   <xsl:param name="addr"/>
	<a>
	<xsl:attribute name="href">
		<xsl:value-of select="$addr"/>
	</xsl:attribute>
	</a>
</xsl:template>>
> -----Original Message-----
> From: Liat Jacob [mailto:jacob_liat@xxxxxxxxxxx]
> Sent: September 17, 2001 3:15 PM
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  How does one go about extracting HTML anchors 
> from an XML
> file?
> 
> 
> Hello all,
> 
> I'm trying to retrieve links and mailto anchors from an XML 
> file and display 
> them in an HTML page ('a href' and 'a mailto' respectively). 
> The problem I'm 
> running into is that I don't know how to extract these 
> anchors properly 
> while preserving the overall hierarchy of the nodes.
> 
> Here's what my XML file looks like:
> 
> <article>
>    <summary>
>       <p>blah blah blah blah blah blah
>          blah <href link='www.yahoo.com'> some link text here</href>
> 	 blah blah <a mailto="jacob_liat@xxxxxxxxxxx>some text here</a>
> 	 blah blah.</p>
>       <p>second paragraph with additional anchors embedded throughout
>          the paragraph text.</p>
>    </summary>
> </article>
> 
> 
> 
> The corresponding XSL file is:
> 
> <xsl:template match="p">
>    <P>
>       <xsl:choose>
>          <xsl:when test="href">
>             <xsl:for-each select="href">
> 	       <xsl:call-template name="href">
> 	          <xsl:with-param name="word">
>                      <xsl:value-of select="."/></xsl:with-param>
> 	       </xsl:call-template>
> 	    </xsl:for-each>
> 	 </xsl:when>
> 	 <xsl:when test="a">
> 	    <xsl:for-each select="a">
> 	       <xsl:call-template name="a">
> 	          <xsl:with-param name="addr">
>                      <xsl:value-of select="."/></xsl:with-param>
> 	       </xsl:call-template>
> 	    </xsl:for-each>
> 	 </xsl:when>
>       </xsl:choose>
>    </P>
>    <xsl:value-of select="."/>
> </xsl:template>
> 
> 
> <xsl:template name="href">
>    <xsl:param name="word"/>
>       <A HREF="http://{@link}"><xsl:value-of select="$word"/></A>
> </xsl:template>
> 
> 
> <xsl:template name="a">
>    <xsl:param name="addr"/>
>       <A HREF="mailto:{@mailto}";><xsl:value-of select="$addr"/></A>
> </xsl:template>
> 
> 
> I'd greatly appreciate if anyone has any ideas and would 
> kindly point me in 
> the right direction.
> 
> Thanks in advance for any help,
> Liat
> 
> _________________________________________________________________
> Get your FREE download of MSN Explorer at 
http://explorer.msn.com/intl.asp


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

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.