Guten Abend,
Edit: Problem gelöst, eine Frage jedoch noch offen :)
Codeausschnitte:
index.php
styleHTML.xsl
Die xml/svg:
Edit:
1.Habe ein Problem gefunden, das file besaß nur die permission 0644, nur hat der 0666 und das abspeichern funktiniert.
2: Nun funktioniert auch die Liste, allerdings mit "<xsl:for-each select="//svg:rect">", falls jemand weiss, wie man dort ohne "//" hin kommt und es mir kurz erklären würde, wäre es sehr nett :)
Wie immer freue ich mich über links zu Erläuterungen genauso wie über eine Erklärung :)
liebe Grüße
Edit: Problem gelöst, eine Frage jedoch noch offen :)
Codeausschnitte:
index.php
Code:
<?php
// Load the XML source
$xml = new DOMDocument;
$xml->load('draw.xml');
$xsl = new DOMDocument;
$xsl->load('style.xsl');
$xslHTML = new DOMDocument;
$xslHTML->load('styleHTML.xsl');
// Configure the transformer
$proc = new XSLTProcessor;
$proc->importStyleSheet($xsl); // attach the xsl rules
$procHTML = new XSLTProcessor;
$procHTML->importStyleSheet($xslHTML); // attach the xsl rules
$doc = new DOMDocument();
$doc->formatOutput = true;
$doc->loadXML($proc->transformToXML($xml));
$docn = $procHTML->transformToXML($xml);
echo $docn;
echo 'Wrote: ' . $doc->save("test.xml") . ' bytes';
$file = 'test.xml';
echo'<br/> Die permission hat man bei diesem Ordner <br/>';
echo substr(sprintf('%o', fileperms($file)), -4);
clearstatcache();
?>
styleHTML.xsl
Code:
<?xml version="1.0" standalone="no"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:svg="http://www.w3.org/2000/svg">
<xsl:output
method="xml"
encoding="utf-8"
doctype-public="-//W3C//DTD SVG 1.1//EN"
doctype-system="http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"/>
<!-- DO sth-->
<xsl:template match="/">
<html>
<body>
<h2>My Points</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>x</th>
<th>y</th>
<th>width</th>
<th>height</th>
<th>fill</th>
</tr>
<xsl:for-each select="//svg:rect">
<tr>
<td><xsl:value-of select="@x"/></td>
<td><xsl:value-of select="@y"/></td>
<td><xsl:value-of select="@width"/></td>
<td><xsl:value-of select="@height"/></td>
<td><xsl:value-of select="@fill"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
Die xml/svg:
Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" width="10cm" height="5cm" version="1.1">
<rect x="0" y="0" width="90" height="90" fill="red"/>
<rect x="0" y="90" width="90" height="90" fill="blue"/>
<rect x="90" y="0" width="90" height="90" fill="green"/>
<rect x="90" y="90" width="90" height="90" fill="yellow"/>
</svg>
Edit:
1.Habe ein Problem gefunden, das file besaß nur die permission 0644, nur hat der 0666 und das abspeichern funktiniert.
2: Nun funktioniert auch die Liste, allerdings mit "<xsl:for-each select="//svg:rect">", falls jemand weiss, wie man dort ohne "//" hin kommt und es mir kurz erklären würde, wäre es sehr nett :)
Wie immer freue ich mich über links zu Erläuterungen genauso wie über eine Erklärung :)
liebe Grüße
Zuletzt bearbeitet: