...

View Full Version : XML (formatted with XSL) in XHTML page



kuvik
07-05-2007, 07:04 PM
Hi,

I want to show XML file (formatted with XSL) in XHTML page. But I don't know how to do this.

XML:


<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="pokus.xsl"?>
<article>
<element>
<type>one</type>
<content>something</content>
</element>
<element>
<type>two</type>
<content>something</content>
</element>
<element>
<type>three</type>
<content>something</content>
</element>
</article>

XSL:


<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" />
<xsl:template match="/">
<h2>Test</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Header1</th>
<th>Header2</th>
</tr>
<xsl:for-each select="article/element">
<tr>
<td><xsl:value-of select="type"/></td>
<td><xsl:value-of select="content"/></td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>

I'm using XHTML 1.1.
I don't know if it is important...:
- that XHTML page is included with PHP into another page
- that XHTML page has .php filename extension.
- and in that XHTML are some DIVs and PHP code.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum