需要有关xml和xsl设计的帮助 [英] Need help with xml and xsl design

查看:50
本文介绍了需要有关xml和xsl设计的帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

这就是我的想法,我将不胜感激任何建议。


我正在尝试为我创建一个xml帮助系统应用。

xml文件的架构将是

< helpsystem>

< help id =" unique id">

< text>文本数据< / text>

< link

href ="可选标记,其将包含对uri的引用

helpanchor ="这也是一个可选属性,它将

指向同一文档中的帮助文件或不同的文档

helpanchorhtmlfile = QUOT;只有当

helpachor属性存在并且基本上将包含html文件名

Hi all
This is what I have in mind and I will appreciate any suggestions.

I am trying to create a xml help system for my application. The schema of
the xml file will be
<helpsystem>
<help id="unique id">
<text>text data</text>
<link
href="optional tag which will hold a reference to a uri"
helpanchor="this is also a optional attribute which will point
to a helpid in the same document or a different document"
helpanchorhtmlfile=" this attribute will only be present if the
helpachor attribute is there and basically will include a html file name"

某些文本数据< / link>
some text data </link>

<时,此属性才会出现br />
< / help>

(任意数量的帮助标签)

< / helpsystem>


在运行时,将读取此xml并将其转换为html。每个帮助

标记将成为一个html表格,帮助标记的每个子项将成为html表格的

行。


链接标记将具有href属性或helpanchor属性,但不具有

。链接标记转换为html< a>标签。

链接标记的href属性转换为< a>的href属性和< link>文本变为

< a>的文本标签。当helpanchorhtmlfile属性存在时,

< a>的href属性将保留此标记给出的引用。


所有这些都非常简单(已经为它编写了xsl样式表)当

链接标记具有属性href。当链接标签

有helpanchor属性时,我遇到了困难,因为对于这个属性,我必须生成一个

单独的html文件,其名称在helpanchorhtmlfile属性中给出。

由于helpanchor指向的帮助ID可能有任何

数量的链接,我必须为任意数量的嵌套级别构建html文件。

在传统编程中,我将使用

递归来完成此任务,但是如何使用xsl执行此操作。如果您有任何

建议请告诉我们,我将非常感谢您的帮助。


Rafia Tapia


Rafia Tapia


</help>
(any number of help tags)
</helpsystem>

At runtime this xml will be read and it will be transform to html. Each help
tag will become a html table and each child of the help tag will become a
row for the html table.

The link tag will either have href attribute or helpanchor attribute but not
both. The link tag trasform to a html <a> tag. The href attribute of the
link tag transform to the href attribute of <a>and the <link> text becomes
the text for the <a> tag. When the helpanchorhtmlfile attribute is present,
the href attribute of <a> will hold the reference given by this tag.

All this is very easy( have already written the xsl stylesheet for it) when
the link tag has the attribute href. My difficulty comes when the link tag
has helpanchor attribute because for this attribute I have to generate a
seperate html file with the name given in the helpanchorhtmlfile attribute.
Since the help id which the helpanchor is pointing itself could have any
number of link, I have to build html files for any number of nested levels.

In a traditional programming I would have accomplish this task using
recursion but how can I do this using xsl. If any of you have any
suggestions please let me know and I will greatly appreciate your help.

Rafia Tapia

Rafia Tapia

推荐答案

Rafia Tapia写道:
Rafia Tapia wrote:
这一切都很简单(已经当链接标签具有属性href时,为它编写xsl样式表。当链接标签
具有helpanchor属性时,我遇到了困难,因为对于这个属性,我必须生成一个
单独的html文件,其名称在helpanchorhtmlfile属性中给出。
自帮助id为helpanchor指向本身可能有任何数量的链接,我必须为任意数量的嵌套级别构建html文件。
这个解释是否意味着你需要从单个

转换中产生多个输出,这是你的问题?

在传统的编程中我会完成这个任务使用递归,但我怎么能用xsl做这个。
All this is very easy( have already written the xsl stylesheet for it) when
the link tag has the attribute href. My difficulty comes when the link tag
has helpanchor attribute because for this attribute I have to generate a
seperate html file with the name given in the helpanchorhtmlfile attribute.
Since the help id which the helpanchor is pointing itself could have any
number of link, I have to build html files for any number of nested levels. Does this explanation mean you need to produce multiple outputs from single
transformation and that''s your problem?
In a traditional programming I would have accomplish this task using
recursion but how can I do this using xsl.



从来没有听说过XSLT递归的任何问题。

-

Oleg Tkachenko
http://www.tkachenko.com/博客

Multiconn Technologies,以色列


Never heard of any problem with recursion in XSLT.
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel


Hello Oleg,
Hello Oleg,
在传统的编程中,我会使用
递归来完成这项任务,但我怎样才能使用xsl。
In a traditional programming I would have accomplish this task using
recursion but how can I do this using xsl.


从未听说过递归的任何问题XSLT。


Never heard of any problem with recursion in XSLT.




虽然如果你想要保持状态(例如递归级别)

你需要得到CREATIV即XSL对状态不太友好

维护,因为模板不应该产生任何副作用

而不是转换输出。


- Joe Geretz -



Although if you''re going to want to maintain state (e.g. recursion level)
you''ll need to get creative. XSL is not very friendly toward state
maintenance since templates aren''t supposed to produce any side effects
other than their transformation output.

- Joe Geretz -


>但是,如果你试图维持一个国家,这是一个问题。


你不应该。


在XSLT中,一个人不会尝试维持状态 - 这不是一个问题。

如果您想使用XSLT,就像使用Fortran一样,那么继续使用Fortran会更好。



=====

干杯,

Dimitre Novatchev。
http://fxsl.sourceforge.net/ - FXSL之家
> Still, if you attempt to "maintain a state," it is a problem.

You shouldn''t.

In XSLT one does not attempt to maintain state -- and this is not a problem.
If you want to use XSLT like you are using Fortran, then it is better for
you to continue to use Fortran.
=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL


这篇关于需要有关xml和xsl设计的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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