xsltArgumentList和xslcompiledtransform的问题 [英] Problem with xsltArgumentList and xslcompiledtransform

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

问题描述

大家好,



新手vb所以请保持温和......



我我试图使用xslcompliedtransform和xsltargumentlist将一些xml转换为另一个xml文件。该文件已创建,但只有一个根元素



主要的projects.xml文件被加载到数据网格视图中,其中包含一些基本的详细信息,一旦单击一行,我想过滤主xml文件,以创建一个包含所选条目的所有xml数据的html报告。



显然,不是完整正确的xml,而是编辑过的结构...



Hi all,

Newbie to vb so please be gentle....

I am trying to transform some xml using xslcompliedtransform and the xsltargumentlist to another xml file. The file is created, but with only a root element

The main projects.xml file is loaded into a data grid view with some basic details, once a row is clicked, i want to filter the main xml file to create a html report containing all the xml data for the selected entry.

Obviously, not the full correct xml, but is an edited structure...

<?xml version="1.0" encoding="UTF-8"?>
<Root>
	<Row A1="123456">
		<F48>Open</F48>
		<F49>Project One</F49>
	</Row>
	<Row A1="654321">
		<F48>Open</F48>
		<F49>Project One A</F49>
	</Row>
	<Row A1="223344">
		<F48>Closed</F48>
		<F49>Project Two</F49>
	</Row>
</Root>





正在使用的XSL :





The XSL being used:

<?xml version="1.0" encoding="UTF-8"?> 
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" />
<xsl:decimal-format name="NN" NaN="0" />
<xsl:param name="ID" />
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="/@* | node()" />
</xsl:copy>
</xsl:template>
<xsl:template match="Root">
<xsl:copy>
<xsl:apply-templates select="Row[@A1=$ID]" />
</xsl:copy>
</xsl:template>
<xsl:template match="Row">
<Row>
<xsl:apply-templates select="@A1 | F49 | F48" />
</Row>
</xsl:template>
</xsl:stylesheet>







单击按钮时运行的vb代码是





The vb code running on a button click is

Dim oXSL As New XslCompiledTransform()
oXSL.Load("findProject.xsl")
Dim oXslArg As New XsltArgumentList()
oXslArg.AddParam("ID", "", dgList.Rows(e.RowIndex).Cells(0).Value
oXSL.Transform(New XPathDocument("projects.xml"), XmlWriter.Create(dgList.Rows(e.RowIndex).Cells(0).Value & ".xml"))







创建的文件是






The file that is created is

<?xml version="1.0" encoding="utf-8"?><Root />







在XML Notepad或其他xml编辑器中运行转换时,t ransform完美运作....任何想法的人?或者有什么更好方法的建议吗?



非常感谢



Graham




When running the transformation in XML Notepad or other xml editor, the transform works perfectly....any ideas people? Or any suggestions for a better method?

Many thanks

Graham

推荐答案

ID] / >
< / xsl:copy >
< / xsl:template >
< xsl:template 匹配 = >
< >
< ; xsl:apply-templates 选择 = @ A1 | F49 | F48 / >
< / Row >
< / xsl:template >
< / xsl:stylesheet >
ID]" /> </xsl:copy> </xsl:template> <xsl:template match="Row"> <Row> <xsl:apply-templates select="@A1 | F49 | F48" /> </Row> </xsl:template> </xsl:stylesheet>







单击按钮时运行的vb代码是





The vb code running on a button click is

Dim oXSL As New XslCompiledTransform()
oXSL.Load("findProject.xsl")
Dim oXslArg As New XsltArgumentList()
oXslArg.AddParam("ID", "", dgList.Rows(e.RowIndex).Cells(0).Value
oXSL.Transform(New XPathDocument("projects.xml"), XmlWriter.Create(dgList.Rows(e.RowIndex).Cells(0).Value & ".xml"))







创建的文件是






The file that is created is

<?xml version="1.0" encoding="utf-8"?><Root />







在XML Notepad或其他xml编辑器中运行转换时,t ransform完美运作....任何想法的人?或者对更好方法的任何建议?



非常感谢



Graham




When running the transformation in XML Notepad or other xml editor, the transform works perfectly....any ideas people? Or any suggestions for a better method?

Many thanks

Graham

这篇关于xsltArgumentList和xslcompiledtransform的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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