Subject: Re: [xsl] probably a XPath mistake From: Nico Van Cleemput <Nicolas.VanCleemput@xxxxxxxx> Date: Tue, 30 Jan 2007 10:23:52 +0100 |
Greets, Nico Van Cleemput Ghent University
Hi Niko,
I think it is a problem with the context the key function is executed in. Change the context to the main document and it should work, see below:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/ Transform"
xmlns:svg="http://www.w3.org/2000/svg">
<xsl:output indent="yes"/>
<xsl:param name="linefactor" select="1"/>
<xsl:key name="vertex" match="coordinates" use="@id"/>
<xsl:variable name="root" select="/"/>
<xsl:template match="embedding">
<svg:svg width="3" height="3">
<xsl:apply-templates select="document('graph.xml')/graph"/>
<xsl:apply-templates select="coordinates"/>
</svg:svg>
</xsl:template>
<xsl:template match="coordinates">
<svg:circle r="{0.075*$linefactor}"
style="stroke:black; stroke-width:{0.05*$linefactor}; fill:white;"
cx="{number(double[1]/@value)+1.5}" cy="{1.5-number(double[2]/ @value)}"/>
</xsl:template>
<xsl:template match="edge">
<xsl:variable name="this" select="."/>
<xsl:for-each select="$root">
<svg:line style="stroke:black; stroke-width:{0.05* $linefactor}; fill:none;"
x1="{number(key('vertex',$this/@from)/double[1]/@value)+1.5}"
y1="{1.5-number(key('vertex',$this/@from)/double[2]/@value)}"
x2="{number(key('vertex',$this/@to)/double[1]/@value)+1.5}"
y2="{1.5-number(key('vertex',$this/@to)/double[2]/@value)}"/>
</xsl:for-each>
</xsl:template>
</xsl:transform>
Regards, George --------------------------------------------------------------------- George Cristian Bina <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] probably a XPath mistake, George Cristian Bina | Thread | Re: [xsl] probably a XPath mistake, George Cristian Bina |
Re: [xsl] probably a XPath mistake, Nico Van Cleemput | Date | Re: [xsl] Copying nested tags and a, Abel Braaksma |
Month |