Einzelnen Beitrag anzeigen

saousan

Registriert seit: 22. Mai 2006
7 Beiträge
 
#1

linien in xml,xsl und svg zeichnen

  Alt 22. Mai 2006, 13:17
Hallo zusammen!ich hab hier ein xml.datei und mit Hilfe von xslt und svg habe ich die drei unten definierten Namen(Hipath,PC_A,Switch_A)in drei rechtecken gezeichnet und jetzt würde gerne die drei mit linien zusammen verbinden aber ich weiss nicht leider wie das geht

xml.datei:

XML-Code:
<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="neudokument.xsl" ?>
<Dokumente>
<Name type="System">Hipath</Name>
<Name type="PC">PC_A</Name>
<Name type="Switch">Switch_A</Name>
</Dokumente>

xsl.datei:

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output
method="xml"
doctype-public="-//W3C//DTD SVG 1.0//EN"
doctype-system="http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"
encoding="ISO-8859-1"
media-type="image/svg+xml"
version="1.0"
indent="yes"
/>


<xsl:template match="/">
<svg version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">

<defs>
<symbol id="graph" style="stroke:black;stroke-width:5px">
<rect x="10" y="10" height="50" width="100" fill="url(#verlauf)" />
</symbol>
</defs>
<xsl:for-each select="Dokumente/Name">
<xsl:sort select="@type" order="ascending" data-type="text" />



<xsl:variable name="anzahl_spalten" select="2" />
<xsl:variable name="pos_x" select="50 + 150 *(((position()-1) mod $anzahl_spalten))" />
<xsl:variable name="pos_y" select="50 + 90 *(((position()-1) div $anzahl_spalten))"/>

<use xlink:href="#graph" >
<xsl:attribute name="x">
<xsl:value-of select="$pos_x"/>
</xsl:attribute>
<xsl:attribute name="y">
<xsl:value-of select="$pos_y"/>
</xsl:attribute>
</use>

<text x="10" y="20">
<xsl:attribute name="x">
<xsl:value-of select="$pos_x + 50" />
</xsl:attribute>
<xsl:attribute name="y">
<xsl:value-of select="$pos_y + 35"/>
</xsl:attribute>
<xsl:value-of select="@type" />
</text>
</xsl:for-each>
</svg>
</xsl:template>
</xsl:stylesheet>
Bitte um Hilfe!

MfG Saousan

[edit=sakura] [xml]-Tags Mfg, sakura[/edit]
  Mit Zitat antworten Zitat