在XSLT中将文本文件插入到View Html中 [英] Insert Text File in XSLT to in View Html

查看:93
本文介绍了在XSLT中将文本文件插入到View Html中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好

我有一个关键问题,

我有一个文本文件作为SampleData.txt

===== ===========文本文件=======================

Microsoft Visual Studio .NET 2008
框架3.5
智能客户端
================文本文件的末尾部分================== ========

我将在XSL中插入此文本文件,使用此语法

< xsl:value-of 选择 =" document('C:\ SampleData.txt'')/ EmployeeInfo / EmployeeRecord < font face = Arial color ="#0000ff"size = 2>"
/>

但是当我尝试查看时在HTML浏览器中,文本文件无法在浏览器中查看

我收到以下错误消息

====错误消息============ ============
XML页面c annot displayed
无法使用XSL样式表查看XML输入。请更正错误,然后单击刷新按钮,或稍后再试

系统无法找到指定的资源
========= END PART OF ERROR MESSAGE =============================

有没有人遇到过这个问题

>请给我解决方案

谢谢




SYEDHANIF

解决方案

目前尚不清楚您想要实现的目标。您的文件不包含任何XML标记,因此您无法使用文档功能加载它。为什么你希望或期望能够在非结构化文本上使用像EmployeeInfo / Employeee这样的XPath,我根本不理解。
如果你想用XSLT使用/加载文本文件那么你可以这样做在XSLT 2.0中使用未解析文本功能。遗憾的是,Microsoft没有XSLT 2.0实现,因此您必须使用第三方工具,如 Saxon 或类似 AltovaXML
如果您在浏览器中使用XSLT,那么您只能使用XSLT 1.0,并且只能使用扩展函数或扩展对象来加载文本文件那么取决于您分别使用浏览器使用的XSLT处理器的浏览器。 IE使用MSXML,如果您需要帮助,请在 MSXML论坛中询问。
如果在.NET框架中使用XslCompiledTransform,那么您还可以使用扩展函数或扩展对象。如果您需要帮助,请告诉我们,我认为最好在XSLT样式表之外解析您的文本,并构建一个XmlDocument,您可以将其作为参数传递给样式表,以便能够使用XSLT / XPath处理它。结果

Hi

I have critical question,

I have a text file as SampleData.txt

================  text file =======================

Microsoft Visual Studio .NET 2008
Framework 3.5
Smart Client
================ END PART OF TEXT FILE ==========================

i will insert this text file in XSL, using this syntax

<xsl:value-of select="document('C:\SampleData.txt'')/EmployeeInfo/EmployeeRecord" />

but when i try to view in the html browser, text file cannot able to view in brower

i am getting the following error message

==== ERROR MESSAGE ========================
 THE XML Page cannot displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later

The system cannot locate the resource specified
=========END PART OF ERROR MESSAGE =============================

did any body have come across this problem

please give me the solution

thanks




SYEDHANIF

解决方案

It is not clear what you want to achieve. Your file does not contain any XML markup so you can't load it with the document function. And why you would want to or expect to be able to use XPath like EmployeeInfo/Employeee on that unstructured text you have I do not understand at all.
If you want to use/load text files with XSLT then you can do that in XSLT 2.0 with the function unparsed-text . Unfortunately Microsoft does not have an XSLT 2.0 implementation so you will have to use third party tools like Saxon or like AltovaXML.
If you use XSLT in the browser then you are restricted to XSLT 1.0 however and loading text files is only possible with extension functions or extension objects where the code then depends on the browser you use respectively the XSLT processor the browser uses. IE uses MSXML, if you need help with that then ask in the MSXML forum.
If you use XslCompiledTransform in the .NET framework then you can also use extension functions or extension objects. Let us know if you need help with that, I think it would be best to parse your text outside of the XSLT stylesheet and build an XmlDocument that you could pass as an argument to the stylesheet to be able to process it with XSLT/XPath.


这篇关于在XSLT中将文本文件插入到View Html中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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