W3C home > Mailing lists > Public > www-svg@w3.org > January 2004

Help Needed: Using SVG command "use xlink:href="#local_variable_name" in XSLT

From: Patrick Soh <chsoh@must.edu.my>
Date: Tue, 20 Jan 2004 19:26:49 +0800
Message-ID: <000801c3df48$4cf9e230$d801a8c0@ITLAB21>
To: <www-svg@w3.org>
Hi, 
I am trying to put into XSL file the SVG command "use xlink:href="#local_variable_name" but XSL keeps rejecting it. The Error Message is "Error in input XSL: Error: Reference to undeclared namespace prefix:'xlink'. 

The XSL works fine if I change the command to "use xlink-href="#local_variable_name" i.e. as long as I do not refer to xlink:href. 

Attached is my xsl file and xml datafile. 

Any help much appreciated. 

By the way, Happy Chinese New Year to all the chinese out there!

Patrick Soh 

<?xml version="1.0"?>
<!-- 1st Style Sheet to convert traffic details -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" />

<xsl:template match="/">
 
<!-- xsl:text disable-output-escaping="yes" -->

<xsl:variable name="loc-id"> </xsl:variable>
<!-- xsl:variable name="dtime"  / -->
<!-- ddtime="{$dtime}{title}"></ddtime -->
<svg xmlns="http://www.w3.org/2000/svg">
<g>
<date> <xsl:value-of select="//page/title" /> </date>
<time>  <xsl:value-of select="//page/row/eventtime" />
</time>


 <xsl:for-each select="//page/row">
  <!-- xsl:text disable-output-escaping="yes" -->
   <use xlink:href="#{$loc-id}{locationid}" stroke="{color}"/>
   <!-- /xsl:text -->
  
 </xsl:for-each>
 </g>
</svg>
<!-- /xsl:text -->
</xsl:template>

</xsl:stylesheet>

My xml data file is 
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="trafficdetails1901.xsl"?>
<page xmlns:sql="http://apache.org/cocoon/SQL/2.0">

<title>19/01/2004 </title>
<row>
 <eventtime>17:00</eventtime>
 <roadid>LDP</roadid>
 <locationid>LDP-Sunway</locationid>
 <description>SMOOTH TRAFFIC</description>
 <color>BLUE</color>
</row>
<row>
 <eventtime>17:00</eventtime>
 <roadid>LDP</roadid>
 <locationid>LDP-Motorola</locationid>
 <description>HEAVY TRAFFIC</description>
 <color>orange</color>
</row>
<row>
 <eventtime>17:00</eventtime>
 <roadid>LDP</roadid>
 <locationid>LDP-PJ</locationid>
 <description>BUMPER-TO-BUMPER TRAFFIC</description>
 <color>red</color>
</row>
</page>
Received on Tuesday, 20 January 2004 06:32:00 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:26 GMT