使用多个XSL文件查看一个XML [英] Viewing one XML using multiple XSL files

查看:90
本文介绍了使用多个XSL文件查看一个XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我星期一开始学习XML。


我有一个XML文件,并编写了一个XSL文件,将其呈现为HTML格式,以便在

格式化查看一个浏览器。我想创建第二个替代

视图的相同数据。我很困惑如何:


如果下面的行指示用于转换我的XML文档的哪个XSL文件应该是
,那么* XML文件

本身*那么如何使用多个XSL来呈现多个视图
同一XML文档的



<?xml-stylesheet type =" text / xsl" href =" myXSL.xsl"?>


我接近错误的方式吗?


-

-Toby

在主题上添加单词afiduluminag以规避我的电子邮件过滤器。

I started learning XML on Monday.

I have an XML file and have written an XSL file to render it to HTML for
formatted viewing in a browser. I''d like to create a second alternative
view of the same data. I am confused how:

If the following line, which dictates which XSL file should be
used to transform my XML document for me, is found *in the XML file
itself* then how can you use more than one XSL to present multiple views
of the same XML document?

<?xml-stylesheet type="text/xsl" href="myXSL.xsl"?>

Am I approaching this the wrong way?

--
-Toby
Add the word afiduluminag to the subject to circumvent my email filters.

推荐答案

Toby Newman写道:
Toby Newman wrote:

如果以下行显示* in用于转换我的XML文档的哪个XSL文件应该是
XML文件

本身*那么如何使用多个XSL来呈现多个视图
同一XML文档的



<?xml-stylesheet type =" text / xsl" HREF =" myXSL.xsl"?>
If the following line, which dictates which XSL file should be
used to transform my XML document for me, is found *in the XML file
itself* then how can you use more than one XSL to present multiple views
of the same XML document?

<?xml-stylesheet type="text/xsl" href="myXSL.xsl"?>



xml-stylesheet处理指令是在HTML

链接元素之后建模的,所以它应该允许你(理论上)有几个这样的

处理建议替代样式表的说明。

但实际上对于XSLT样式表我不认为任何主要的

桌面浏览器喜欢IE 6及更高版本,Mozilla / Firefox或Opera支持。

另一方面,这样的处理指令并不妨碍你使用脚本和XSLT处理器API服务器可根据您的喜好应用不同的

样式表。


-


Martin Honnen
http://JavaScript.FAQTs.com/


在2007-01-25,Martin Honnen< ma ******* @ yahoo.dewrote:
On 2007-01-25, Martin Honnen <ma*******@yahoo.dewrote:

Toby Newman写道:
Toby Newman wrote:

>如果在XML文件中找到以下行,该行指示哪个XSL文件应该用于转换我的XML文档,那么你怎么能使用更多比一个XSL提供相同XML文档的多个视图?

<?xml-stylesheet type =" text / xsl" HREF =" myXSL.xsl"?>
>If the following line, which dictates which XSL file should be
used to transform my XML document for me, is found *in the XML file
itself* then how can you use more than one XSL to present multiple views
of the same XML document?

<?xml-stylesheet type="text/xsl" href="myXSL.xsl"?>



xml-stylesheet处理指令是在HTML

链接元素之后建模的,所以它应该允许你(理论上)有几个这样的

处理建议替代样式表的说明。

但实际上对于XSLT样式表我不认为任何主要的

桌面浏览器喜欢IE 6及更高版本,Mozilla / Firefox或Opera支持。

另一方面,这样的处理指令并不妨碍你使用脚本和XSLT处理器API服务器可以根据需要应用不同的

样式表。


The xml-stylesheet processing instruction is modelled after the HTML
link element so it should allow you (in theory) to have several such
processing instructions to suggest alternative stylesheets.
However in reality for XSLT stylesheet I don''t think any of the major
desktop browsers like IE 6 and later, Mozilla/Firefox or Opera support that.
On the other hand such a processing instruction does not prevent you to
use script and an XSLT processor API on the server to apply different
stylesheet as you like or want.



是否可以在URL中对我想要的
使用的XSL的文件名进行编码?

喜欢这样:

http ://www.domain.com/myxml.xml?XSLT = viewOne.xsl
http://www.domain.com/myxml.xml?XSLT=viewTwo.xsl


我''之前在PHP中完成了这项工作,并且知道如何使用PHP从

URL获取变量。我现在不是在使用PHP文件,但是,我正在使用XML文件。

XML文件不是服务器端脚本,所以我可以获取

变量以某种方式来自XML中的URL?


-

-Toby

500 Nintendo Stars for trade :2xWii游戏

* * * * * * * * * * * * * * * * * * * * * * *

将afiduluminag添加到主题绕过我的电子邮件过滤器。

Would it be possible to encode the filename of the XSL that I want to
use in the URL?
Like this:

http://www.domain.com/myxml.xml?XSLT=viewOne.xsl
http://www.domain.com/myxml.xml?XSLT=viewTwo.xsl

I''ve done this before in PHP and know how to get the variables from the
URL using PHP. I''m not using PHP files now, though, I''m using XML files.
XML files aren''t server-side scripted, though, so can I fetch the
variable somehow in from the URL within XML?

--
-Toby
500 Nintendo Stars for trade: 2xWii Play
* * * * * * * * * * * * * * * * * * * * * * *
Add the word afiduluminag to the subject to circumvent my email filters.


Toby Newman写道:
Toby Newman wrote:

是否可以对文件名进行编码我希望在URL中使用
的XSL?

像这样:

http://www.domain.com/myxml.xml?XSLT=viewOne.xsl
http://www.domain.com/myxml.xml? XSLT = viewTwo.xsl


我做到了这一点在PHP之前,知道如何使用PHP从

URL获取变量。我现在不是在使用PHP文件,但是,我正在使用XML文件。

XML文件不是服务器端脚本,所以我可以获取
从XML中的URL以某种方式
变量?
Would it be possible to encode the filename of the XSL that I want to
use in the URL?
Like this:

http://www.domain.com/myxml.xml?XSLT=viewOne.xsl
http://www.domain.com/myxml.xml?XSLT=viewTwo.xsl

I''ve done this before in PHP and know how to get the variables from the
URL using PHP. I''m not using PHP files now, though, I''m using XML files.
XML files aren''t server-side scripted, though, so can I fetch the
variable somehow in from the URL within XML?



您需要服务器端脚本读取查询字符串并运行

转换例如
http://example.com/transform.php?xml ... lt = viewOne.xsl

然后transform.php读出文件名,运行转换并且

将转换结果发送给客户端。


-


Martin Honnen
http://JavaScript.FAQTs.com/


这篇关于使用多个XSL文件查看一个XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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