You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Leszek Gawron <ou...@vip.net.pl> on 2002/05/12 22:22:05 UTC
namespace prefixes declarations in output HTML (repost - sorry if you got it twice)
[Sorry if you got this mail twice - I have some problems with my SMTP
server]
I know that this subject has already been discussed but I think with no
success I'm preparing a cross-platform system for very thin clients
(PDAs for example) I'd like to strip all namespace declarations before
serialization. I have seen somewhere on the mailing archives that I
should use exclude-result-prefixes directive.
So I have (the version I'm presenting is still not optimal in case of
size - I have to use CSS stylesheets also):
1. A simple xsp file:
<?xml version="1.0" encoding="UTF-8"?>
<xsp:page language="java" xmlns:xsp="http://apache.org/xsp"
xmlns:xsp-formval="http://apache.org/xsp/form-validator/2.0"
xmlns:xsp-request="http://apache.org/xsp/request/2.0">
<page>
<title>Login page</title>
<body>
<para>
<b>Enter login information:</b>
</para>
<form action="login" method="POST">
<input type="hidden" name="visited"
value="true"/>
<xsp:logic>
boolean userHasSeenForm = (<xsp-request:get-parameter
name="visited"/> != null );
</xsp:logic>
<xsp-formval:descriptor
name="descriptors/login.xml"
constraint-set="login-info">
<xsp-formval:validate
name="username">
<xsp:logic>
if (userHasSeenForm) {
if ( <xsp-formval:is-null/> ) {
<div align="center">
<b>Please provide a valid
username</b>
</div>
} else if (
<xsp-formval:is-toolarge/> ) {
<div align="center">
<b>Username too long</b>
</div>
}
}
</xsp:logic>
[...]
and so on - this is not important here
2. my stylesheet is :
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="xsp xsp-request xsp-formval">
<xsl:template match="page">
<html>
<head>
<title>
<xsl:value-of select="title"/>
</title>
<META content="0" http-equiv="expires"/>
<META content="nocache"
http-equiv="pragma"/>
</head>
<xsl:apply-templates/>
</html>
</xsl:template>
<xsl:template match="title"/>
<xsl:template match="body">
<body style="font-family: Tahoma;font-size: 10pt"
bgcolor="#FAEBD7">
<xsl:apply-templates/>
</body>
</xsl:template>
<xsl:template match="para">
<p align="center"><xsl:apply-templates/></p>
</xsl:template>
<xsl:template match="br">
<br/>
</xsl:template>
<xsl:template match="link">
<a href="{@href}"><xsl:value-of select="."/></a>
</xsl:template>
<xsl:template match="@*|node()" priority="-2">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="text()" priority="-1">
<xsl:value-of select="."/>
</xsl:template>
</xsl:stylesheet>
Although I have included exclude-result-prefixes="xsp xsp-request
xsp-formval" still the output is:
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Login page</title> <META http-equiv="expires" content="0"> <META
http-equiv="pragma" content="nocache"> </head>
<body bgcolor="#FAEBD7" style="font-family: Tahoma;font-size: 10pt">
<p align="center">
<b xmlns:xsp="http://apache.org/xsp"
xmlns:xspdoc="http://apache.org/cocoon/XSPDoc/v1"
xmlns:xsp-formval="http://apache.org/xsp/form-validator/2.0"
xmlns:xsp-request="http://apache.org/xsp/request/2.0">Enter login
information:</b>
</p>
<form xmlns:xsp="http://apache.org/xsp"
xmlns:xspdoc="http://apache.org/cocoon/XSPDoc/v1"
xmlns:xsp-formval="http://apache.org/xsp/form-validator/2.0"
xmlns:xsp-request="http://apache.org/xsp/request/2.0" action="login"
method="POST">
<input type="hidden" name="visited" value="true">
so it's more than ugly (the namespace declarations have been propagated
to all tags that are not explicitly matched in the xsl stylesheet>
What can I do ?
ouzo
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>