没有HTML标签 [英] no html tags

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

问题描述

我正在使用xsl样式表处理一些xml,并且由于某种原因,我

有一个样式表在

输出中没有产生所需的html标签。我无法弄清楚为什么这个样式表与

不同我所有其他人都非常成功。


这是关键标签我正在使用:


< xsl:stylesheet version =" 1.0" xmlns:xsl =" http://www.w3.org/1999/XSL/

转换"

xmlns:redirect =" org.apache.xalan。 xslt.extensions.R edirect extension-

element-prefixes =" redirect">

< xsl:output method =" html"媒体类型= QUOT; text / html的" version =" 4.0"

indent =" yes"

doctype-public =" - // W3C // DTD XHTML 1.0 Transitional // EN"

encoding =" ISO-8859-1" />


这是我的一个模板应该生成的示例

html:

< xsl:template match =" para">

< p>< xsl:apply-templates /> < / p>

< / xsl:template>


不能比这简单,呃?


由于我使用其他样式表生成其他html输出,这个

似乎不是配置问题。


任意非常感谢我应该寻找的提示!


TIA,

David

I''m processing some xml with xsl stylesheets and, for some reason, I
have one stylesheet that does not produce the needed html tags in the
output. I can''t figure out why this stylesheet would be different from
all my others which I''m using quite successfully.

Here are the key tags I''m using:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/
Transform"
xmlns:redirect="org.apache.xalan.xslt.extensions.R edirect" extension-
element-prefixes="redirect">
<xsl:output method="html" media-type="text/html" version="4.0"
indent="yes"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
encoding="ISO-8859-1"/>

Here''s an example of one of my templates that should be producing
html:
<xsl:template match="para">
<p><xsl:apply-templates/></p>
</xsl:template>

Can''t get simpler than that, eh?

As I produce other html output just fine with other stylesheets, this
doesn''t seem to be a configuration issue.

Any hints re what I should look for would be greatly appreciated!

TIA,
David

推荐答案

实际上是否调用了该模板?查看您的XSLT处理器的
跟踪/调试功能,和/或关于样式的developerWorks文章

样式表,以便他们报告跟踪信息。

你没有给我们任何足够的信息,但我的猜测会是:b
$ b:你没有根模板,或者有什么东西不是执行

需要apply-templates才能在输入文档中达到这一点,或者

您的输入文档是命名空间。

-

Joe Kesselman /小心病人的愤怒。 - John Dryden
Is that template actually being invoked? See your XSLT processor''s
trace/debugging features, and/or my developerWorks articles on styling
stylesheets so they report trace information.

You didn''t give us anywhere near enough info, but my wild guesses would
be one of: you don''t have a root template, or something isn''t doing the
needed apply-templates to reach this point in the input document, or
your input document is namespaced.
--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden


Joseph Kesselman写道:
Joseph Kesselman wrote:

该模板是否实际被调用?查看您的XSLT处理器的
跟踪/调试功能,和/或关于样式的developerWorks文章

样式表,以便他们报告跟踪信息。
Is that template actually being invoked? See your XSLT processor''s
trace/debugging features, and/or my developerWorks articles on styling
stylesheets so they report trace information.



或者只是插入一个xsl:消息,看它是否出现在控制台上。


-

Joe Kesselman /小心病人的愤怒。 - John Dryden

Or just insert an xsl:message and see if it appears on the console.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden


5月10日下午12:31,Joseph Kesselman< keshlam-nos ... @ comcast.net>

写道:
On May 10, 12:31 pm, Joseph Kesselman <keshlam-nos...@comcast.net>
wrote:

Joseph Kesselman写道:
Joseph Kesselman wrote:

该模板是否实际被调用?查看您的XSLT处理器的
跟踪/调试功能,和/或关于样式的developerWorks文章

样式表,以便他们报告跟踪信息。
Is that template actually being invoked? See your XSLT processor''s
trace/debugging features, and/or my developerWorks articles on styling
stylesheets so they report trace information.



或者只是插入一个xsl:消息,看看它是否出现在控制台上。


-

Joe Kesselman /小心病人的愤怒。 - John Dryden


Or just insert an xsl:message and see if it appears on the console.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden



对不起,我在原帖中并不清楚。我知道

正在访问各种模板,因为xml数据是

输出;它们根本不受模板中使用的

的html标签的限制。要使用上面的''para''模板,我会收到

段落,但它们并没有被< p>< / p>包围。


我也使用< xsl:message>确认了这个。


David

Sorry that I wasn''t clearer in my original posting. I know that the
various templates are being accessed because the xml data are being
output; they simply aren''t being bounded by the html tags that are
used in the templates. To use the ''para'' template above, I get the
paragraphs but they''re not surrounded by <p></p>.

I also confirmed this using <xsl:message>.

David


这篇关于没有HTML标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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