RE: [xsl] Problems transforming a <A HREF> link using XSL

Subject: RE: [xsl] Problems transforming a <A HREF> link using XSL
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 18 Nov 2005 09:09:08 -0000
You want <xsl:copy-of> rather than <xsl:value-of>.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: Allison Bloodworth [mailto:abloodworth@xxxxxxxxxxxx] 
> Sent: 18 November 2005 02:04
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Problems transforming a <A HREF> link using XSL
> 
> Hi, 
> 
> I am trying to transform an XML document, which includes some HTML <a
> href=.> links, into another XML document. However, when I do the
> transformation, the <a href=..>Name of link</a> info is lost 
> and all I see
> is the name of the link. I've tried using output methods of 
> "xml" "html" and
> "text" to no avail. Does anyone know how to fix this problem?
> 
> <?xml-stylesheet type="text/xsl" href="Sports.xsl"?>
> <feed>
> <update_stamp>11/10/2005 08:14:47</update_stamp>
>    <event>
>       <id>472691</id>
>       <date>12/03/2005</date>
>       <time>1:00 PM</time>
>       <sport>w-baskbl</sport>
>       <sport_name>W Basketball</sport_name>
>       <opponent><![CDATA[UNLV vs. Albany (CC Times 
> Classic)]]></opponent>
>       <location><![CDATA[Berkeley]]></location>
>       <tv></tv>
>       <home_visitor>H</home_visitor>
>       <outcome><![CDATA[]]></outcome>
>       <recap></recap>
>       <stats></stats>
>       <notes></notes>
>       <quotes></quotes>
>       <gallery></gallery>
>       <gametracker><a
> href="JavaScript:window.open('http://livestats.calbears.colleg
> esports.com/li
> vestats/data/w-baskbl/354046/','wbaskblGameTracker','toolbar=n
o,resizable=no
> ,scrollbars=no,width=780,height=540');
> void('');">Gametracker</a></gametracker>
>    </event>
> </feed>
> 
> Top of XSL stylesheet:
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> xmlns:xs="http://www.w3.org/2001/XMLSchema";
> xmlns:dt="http://xsltsl.org/date-time";>
> <xsl:import href="http://xsltsl.sourceforge.net/modules/stdlib.xsl"/>
> <xsl:output method="xml" indent="yes"/>
> 
> Pertinent portion of stylesheet (I test to see if the element 
> exists before
> I print it): 
> 
>             <xsl:template match="gametracker">
>                         <xsl:if test="normalize-space(.)">
>             Gametracker: <xsl:value-of select="."/>
>                         </xsl:if>
>             </xsl:template>
> 
> I want this in the resultant XML file:
> <Description>
>             Gametracker: <a
> href="JavaScript:window.open('http://livestats.calbears.colleg
> esports.com/li
> vestats/data/w-baskbl/354046/','wbaskblGameTracker','toolbar=n
o,resizable=no
> ,scrollbars=no,width=780,height=540'); void('');">Gametracker</a>
> </Description>
> 
> But I get this:
> 
> <Description>
>             Gametracker: Gametracker
> </Description>
> 
> Thanks very much for any help you can give me!
> 
> Allison Bloodworth
> Principal Administrative Analyst
> e-Berkeley Program Office
> University of California, Berkeley
> (415) 377-8243
> abloodworth@xxxxxxxxxxxx

Current Thread