如何将XML转换为XSLT以便在UI中呈现 [英] How do I transform XML to XSLT so that it renders in UI

查看:81
本文介绍了如何将XML转换为XSLT以便在UI中呈现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是xml和xslt的新手。我坚持下去了:

我遵循XML:



 <  参数    count   =  2 >  
< 参数 > ;
< ParamId > 1 < / ParamId > ;
< 名称 > accountId < / Name >
< IsRequired > 1 < / IsRequired >
< 类型 > long < / Type >
< ParamValue > 123456 < / ParamValue >
< /参数 >
< 参数 >
< ParamId > 2 < / ParamId >
< 名称 > accountholder < / Name >
< IsRequired > 1 < / IsRequired >
< 类型 > 字符串< /类型 >
< ParamValue > Robert < / ParamValue >
< /参数 >
< /参数 >







我需要将其转换为xslt,以便在呈现UI时可以将其显示为单个DIV,每个参数作为行项。 Nameno为标签,ParamValue节点的值显示在可编辑的textarea中。



您将非常感谢您的帮助。



谢谢,

Abhishek



我尝试过什么:



我是新手,无法决定如何继续进行。

解决方案

< blockquote>通常,您使用XSLT文件将XML文件转换为另一个文档。您不会将XML转换为XSLT。

您应该阅读有关XSLT文件使用的基本概念:

XSLT - 维基百科 [ ^ ]

XSLT - W3Schools [ ^ ]

如果你是新人,你必须学习;没有其他办法:)



祝你好运。


I'm new to xml and xslt. and I'm stuck with it:
I've following XML:

<Parameters count="2">
		<Parameter>
			<ParamId>1</ParamId>
			<Name>accountId</Name>
			<IsRequired>1</IsRequired>
			<Type>long</Type>
			<ParamValue>123456</ParamValue>
		</Parameter>
		<Parameter>
			<ParamId>2</ParamId>
			<Name>accountholder</Name>
			<IsRequired>1</IsRequired>
			<Type>string</Type>
			<ParamValue>Robert</ParamValue>
		</Parameter>
	</Parameters>




I need to transform it into xslt so that at UI when rendered it could be dispalyed in a single DIV with each parameter as a row item. The "Name" noide being the label and the "ParamValue" node's value displayed in a editable textarea.

You help would be highly appreciated.

Thanks,
Abhishek

What I have tried:

I'm new and Couldn't decide how to proceed further.

解决方案

Usually, you use a XSLT file to transform an XML file to another document. You don't transform XML to XSLT.
You should read basic notions about usage of XSLT files:
XSLT - Wikipedia[^]
XSLT - W3Schools[^]
If you are new, you have to learn; there is no other way :)

Good luck.


这篇关于如何将XML转换为XSLT以便在UI中呈现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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