Topic: XSTL => 2 Namespaces in XHTML => XHTML invalid Pages that link to <a href="https://ozoneasylum.com/backlink?for=22901" title="Pages that link to Topic: XSTL =&amp;gt; 2 Namespaces in XHTML =&amp;gt; XHTML invalid" rel="nofollow" >Topic: XSTL =&gt; 2 Namespaces in XHTML =&gt; XHTML invalid\

 
Author Thread
sparkyindustries
Neurotic (0) Inmate
Newly admitted

From:
Insane since: Aug 2004

IP logged posted posted 08-12-2004 02:24 Edit Quote

Hy, i'm having a serious problem with XSLT, it produces two namespaces, so that my XHTML-File is invalid.

XML-Dokument:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="personen.xsl"?>
<personen xmlns="http://localhost/personen" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://localhost/personen personen.xsd">
<person id="1">
<name>flo</name>
<alter>20</alter>
</person>
<person id="2">
<name>doris</name>
<alter>14</alter>
</person>
<person id="3">
<name>bernd</name>
<alter>23</alter>
</person>
</personen>


XSL-Dokument

<?xml version='1.0' encoding="UTF-8"?>
<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" xmlns:data="http://localhost/personen" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" default-validation="strict">

<xslutput method="xhtml" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="no" doctype-public="-//W3C/DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" standalone="no" media-type="text/xhtml"/>

<xsl:template match="/" >
<html>
<head>
<title>Personen</title>
<link rel="stylesheet" type="text/css" href="personen.css" />
</head>
<body>
<table>
<tr>
<th>ID</th>
<th>Name</th>
<th>Alter</th>
</tr>
<xsl:for-each select="dataersonen/dataerson">
<tr>
<td><xsl:value-of select="@id"/></td>
<td><xsl:value-of select="data:name"/></td>
<td><xsl:value-of select="data:alter"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>


XSLT Processes without any Errors, but the final XHTML-Dokument is invalid => see Explanation

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html
PUBLIC "-//W3C/DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:data="http://localhost/personen">
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8"/>
<title>Personen</title>
<link rel="stylesheet" type="text/css" href="personen.css" />
</head>
<body>
<table>
<tr>
<th>ID</th>
<th>Name</th>
<th>Alter</th>
</tr>
<tr>
<td>1</td>
<td>flo</td>
<td>20</td>
</tr>
<tr>
<td>2</td>
<td>doris</td>
<td>14</td>
</tr>
<tr>
<td>3</td>
<td>bernd</td>
<td>23</td>
</tr>
</table>
</body>
</html>


HERE IS MY PROBLEM:
This XHTML-Dokument is (refering to W3C Recommendation) invaild, because it contains a second namespace. This is because i have to insert the data-namespace in the XSL-Document, because i want to access the data from the XML-Document.
But - i think this rule is called ***NAMESPACE FIXUP*** says, that all the namespaces on the Elements of the XSL-Document have to be transfered / added to the result-document (XHTML) ...

CAN ANYBODY HELP ME - i have to get rid of the data-namespace, so that the XHTML-document is valid !!!! PLEASE, help me

thanks, flo

sparkyindustries
Obsessive-Compulsive (I) Inmate

From:
Insane since: Aug 2004

IP logged posted posted 08-12-2004 02:28 Edit Quote

oh, i think it is better to quote the source:

code:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="personen.xsl"?>
<personen xmlns="http://localhost/personen" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://localhost/personen personen.xsd">
<person id="1">
<name>flo</name>
<alter>20</alter>
</person>
<person id="2">
<name>doris</name>
<alter>14</alter>
</person>
<person id="3">
<name>bernd</name>
<alter>23</alter>
</person>
</personen>




XSL-Document:

code:
<?xml version='1.0' encoding="UTF-8"?>
<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" xmlns:data="http://localhost/personen" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" default-validation="strict">

<xsl:output method="xhtml" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="no" doctype-public="-//W3C/DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" standalone="no" media-type="text/xhtml"/>

<xsl:template match="/" >
<html>
<head>
<title>Personen</title>
<link rel="stylesheet" type="text/css" href="personen.css" />
</head>
<body>
<table>
<tr>
<th>ID</th>
<th>Name</th>
<th>Alter</th>
</tr>
<xsl:for-each select="data:personen/data:person">
<tr>
<td><xsl:value-of select="@id"/></td>
<td><xsl:value-of select="data:name"/></td>
<td><xsl:value-of select="data:alter"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>




XHTML-Document:

code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html
PUBLIC "-//W3C/DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:data="http://localhost/personen">
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8"/>
<title>Personen</title>
<link rel="stylesheet" type="text/css" href="personen.css" />
</head>
<body>
<table>
<tr>
<th>ID</th>
<th>Name</th>
<th>Alter</th>
</tr>
<tr>
<td>1</td>
<td>flo</td>
<td>20</td>
</tr>
<tr>
<td>2</td>
<td>doris</td>
<td>14</td>
</tr>
<tr>
<td>3</td>
<td>bernd</td>
<td>23</td>
</tr>
</table>
</body>
</html>



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu