XSLT XHTML MIX DOCTYPE问题 [英] XSLT XHTML MIX DOCTYPE PROBLEM

查看:96
本文介绍了XSLT XHTML MIX DOCTYPE问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好我有一个必须支持xhtml实体的xsl样式表,

我的解决方案:

----


<?xml version =" 1.0" encoding =" ISO-8859-1"?>

<!DOCTYPE xsl:stylesheet [

<!ENTITY%xhtml PUBLIC" - // W3C // DTD XHTML 1.0 Strict // EN"

" http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

%xhtml;

]>


< xsl:stylesheet version =" 1.0"

xmlns = http://www.w3.org/1999/xhtml"

xmlns:xsl =" http://www.w3.org/1999/XSL/Transform"

xmlns:page =" http://www.wolterinkwebdesign.com/xml/page"

xmlns:form =" http://www.wolterinkwebdesign.com/xml/表格">


< xsl:include href =" xsl / xhtml / standard.xsl" />

< xsl:output method = QUOT; XML" indent =" yes" />


< xsl:param name =" absolute_url" />

< xsl:param name = " upload_url" />

< xsl:variable name =" help_icon" select =" concat($ absolute_url,''/ img / help_icon.gif'')" />

< xsl:variable name =" error_icon" select =" concat($ absolute_url,''/ img / error.gif'')" />

< xsl:variable name =" max_file_size" select =" 2000000" />

< xsl:variable name =" max_image_width" select =" 260" />


< xsl:template match =" / form:form">

< page:page type =" module">

< form enctype =" multipart / form-data"行动= QUOT;" method =" post">

< input type =" hidden"名称= QUOT; _xcm_module"值= QUOT; {@模块}" />

---- xsl文件更长

但是当我在我的xml编辑器中编辑这个文件时,它抱怨每个< xsl:元素都必须被声明。

例如:

元素类型" xsl:include"必须申报。


我知道问题是什么(我改变了xsl:stylesheet的doctype)

但是我不知道解决方案!


请帮忙。

解决方案

absolute_url,''/ img / help_icon.gif'')" /> ;

< xsl:variable name =" error_icon" select =" concat(


absolute_url,''/ img / error.gif'')" />

< xsl:variable name = " MAX_FILE_SIZE" select =" 2000000" />

< xsl:variable name =" max_image_width" select =" 260" />


< xsl:template match =" / form:form">

< page:page type =" module">

< form enctype =" multipart / form-data"行动= QUOT;" method =" post">

< input type =" hidden"名称= QUOT; _xcm_module"值= QUOT; {@模块}" />

---- xsl文件更长

但是当我在我的xml编辑器中编辑这个文件时,它抱怨每个< xsl:元素都必须被声明。

例如:

元素类型" xsl:include"必须申报。


我知道问题是什么(我改变了xsl:stylesheet的doctype)

但是我不知道解决方案!


请帮忙。



你好我有一个必须支持的xsl样式表xhtml实体,
我的解决方案:




为什么必须使用这些实体?


是否使用& #1 6 0;或者& n b s p;在样式表中永远不会

对结果产生任何影响。


如果你使用数字

字符引用(或直接使用字符)而不是

加载XHTML DTD。


如果你真的想使用然后DTD你需要一个解析器,它读取外部DTD实体,但不验证。大多数解析器都会这样做

但是他们可能需要一个特殊的配置选项。一些解析器默认

如果文件以DOCTYPE开头验证模式,你永远不需要

对于XSLT(如你所见:-)

如果你说你正在使用哪个系统可能会告诉你

你需要做什么处理器来关闭验证,但

正如我上面所说,你可以通过在样式表中不使用DOCTYPE

来避免整个问题。


David


Hello i''ve an xsl stylesheet that must support xhtml entities,
my solution:
----

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY % xhtml PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
%xhtml;
]>

<xsl:stylesheet version="1.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:page="http://www.wolterinkwebdesign.com/xml/page"
xmlns:form="http://www.wolterinkwebdesign.com/xml/form">

<xsl:include href="xsl/xhtml/standard.xsl"/>
<xsl:output method="xml" indent="yes"/>

<xsl:param name="absolute_url"/>
<xsl:param name="upload_url"/>
<xsl:variable name="help_icon" select="concat($absolute_url, ''/img/help_icon.gif'')"/>
<xsl:variable name="error_icon" select="concat($absolute_url, ''/img/error.gif'')"/>
<xsl:variable name="max_file_size" select="2000000 "/>
<xsl:variable name="max_image_width" select="260"/>

<xsl:template match="/form:form">
<page:page type="module">
<form enctype="multipart/form-data" action="" method="post">
<input type="hidden" name="_xcm_module" value="{@module}" />
---- xsl file is longer
But when i edit this file in my xml-editor it complains that every <xsl: element must be declared.
For example:
Element type "xsl:include" must be declared.

I know what the problem is (i changed the doctype of xsl:stylesheet)
but i dont know the solution!

Please help.

解决方案

absolute_url, ''/img/help_icon.gif'')"/>
<xsl:variable name="error_icon" select="concat(


absolute_url, ''/img/error.gif'')"/>
<xsl:variable name="max_file_size" select="2000000 "/>
<xsl:variable name="max_image_width" select="260"/>

<xsl:template match="/form:form">
<page:page type="module">
<form enctype="multipart/form-data" action="" method="post">
<input type="hidden" name="_xcm_module" value="{@module}" />
---- xsl file is longer
But when i edit this file in my xml-editor it complains that every <xsl: element must be declared.
For example:
Element type "xsl:include" must be declared.

I know what the problem is (i changed the doctype of xsl:stylesheet)
but i dont know the solution!

Please help.



Hello i''ve an xsl stylesheet that must support xhtml entities,
my solution:



why must it use these entities?

whether you use & # 1 6 0 ; or & n b s p ; within the stylesheet never
makes any difference to the result.

So you (and the processor) will have a simpler job if you used numeric
character references (or just use the characters directly) rather than
loading up the XHTML DTD.

If you really want to use the DTD then you will need a parser that reads
an external DTD entity but does not validate. Most parsers will do this
but they may need a special configurartion option. Some parsers default
to validating mode if the file starts with a DOCTYPE and you never want
that for XSLT (as you found:-)

If you say which system you are using someone may be able to tell you
what processor specific thing you need to do to turn off validation, but
as I say above you can avoid the entire problem by not using a DOCTYPE
in the stylesheet.

David


这篇关于XSLT XHTML MIX DOCTYPE问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆