...das ganze ist wie folgt aufgebaut:
Die XML-Datei:
<?xml version="1.0" encoding="UTF-8" ?>
<root>
<Schema xmlns="urn:schemas-microsoft-com:xml-data" xmlns:dt="urn:schemas-microsoft-com:datatypes">
<ElementType name="xyz" content="mixed" model="closed">
<element type="version" />
<element type="uniqueid" />
<element type="chainhistory" />
<element type="title" />
<element type="storydate" />
<element type="storytime" />
<element type="codes" />
<element type="subtext" />
<element type="fulltext" />
</ElementType>
<ElementType name="version" content="textOnly" model="closed" dt:type="number" />
<ElementType name="uniqueid" content="textOnly" model="closed" dt:type="string" />
<ElementType name="chainhistory" content="textOnly" model="closed" dt:type="string" />
<ElementType name="title" content="textOnly" model="closed" dt:type="string" />
<ElementType name="storydate" content="textOnly" model="closed" dt:type="date" />
<ElementType name="storytime" content="textOnly" model="closed" dt:type="time" />
<ElementType name="codes" content="mixed" model="closed">
<AttributeType name="codetype" dt:type="enumeration" dt:values="country subject other" />
<attribute type="codetype" required="yes" />
</ElementType>
<ElementType name="subtext" content="textOnly" model="closed" dt:type="string" />
<ElementType name="fulltext" content="textOnly" model="closed" dt:type="string" />
</Schema>
<DJStory>
<version>1.0</version>
<uniqueid>2007</uniqueid>
<chainhistory>2007</chainhistory>
<title>
<![CDATA[Text]]>
</title>
<storydate>2007-11-16</storydate>
<storytime>17:12</storytime>
<codes codetype="country">R/EC,R/EU,R/GE,R/WEU</codes>
<codes codetype="subject">N/DJGE,N/CNW,N</codes>
<codes codetype="industry">I/SCR</codes>
<codes codetype="other"></codes>
<subtext/>
<fulltext><![CDATA[<FONT FACE="Arial" class="NormalMinus1">
<p>
Text
</p>
<pre>
Text
</pre>
<p>
(END) Text
</p>
<p>
Datum
</p>
</FONT>]]>
</fulltext>
</xyz>
</root>
Das Parsen mit einer XSL-Datei:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/TR/xhtml1/strict">
<xsl:output method="html" version="4.0" indent="yes" encoding="UTF-8" media-type="text/html"/>
<xsl:template match="xyz">
<html>
<head>
<title>
<xsl:value-of select="title"/>
</title>
<style type="text/css">
.ueberschrift { font-family:Verdana; font-style:normal; font-weight: bolder; }
.parameter { font-family:Verdana; font-style:normal; font-size:70%; }
.haupttext { font-family:Verdana; font-style:normal; font-size:100%; }
</style>
</head>
<body>
<p><span class="ueberschrift">
<xsl:value-of select="title "/>
</span>
</p>
<p><span class="parameter">
Datum: <xsl:value-of select="storydate"/>
Uhrzeit: <xsl:value-of select="storytime"/>
</span>
</p>
<p><span class="haupttext">
<xsl:value-of select="subtext"/>
<xsl:value-of select="fulltext"/>
</span></p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Die Ausgabe mittels einer PHP-Datei (nur dieser Ausschnitt ist auch dargestellt):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<Html>
<HEAD>
.......
<?php
// Create an XSLT processor
$xsltproc = xslt_create();
// Perform the transformation
$html1 = xslt_process($xsltproc, 'news.xml', 'news.xsl');
// Perform the transformation
$html2 = xslt_process($xsltproc, 'news2.xml', 'news2.xsl');
// Detect errors
if (!$html1) die('XSLT processing error: '.xslt_error($xsltproc));
// Destroy the XSLT processor
xslt_free($xsltproc);
// Output the resulting HTML
echo html_entity_decode($html1,ENT_QUOTES);
// Detect errors
if (!$html2) die('XSLT processing error: '.xslt_error($xsltproc));
// Output the resulting HTML
echo html_entity_decode($html2,ENT_QUOTES);
?>
Damit wäre nun der Zusammenhang hergestellt mit dem Problem, dass die Website Frontend PHP-Datei die XML-Dokumente unformatiert darstellt.
Ich hoffe dies erklärt das Problem besser.
Gruß
Jo
Hellihello Jo73,
Dein Problem kapiere ich nicht. XML wird in Deinem Fall mittels XLS in ein HTML-Dokument umgeschrieben.
a) wie parsed (oder wie heißt das?) Du das xml - Dokument
b) wie sieht die XML-Quelle aus
c) wie sieht die HTML-Ausgabe aus?Gruß,
frankx