本文介绍了xmlsignature形式的XSLT转换,是xmldocument的一部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个HTML页面(表单),用户可以在其中输入他的详细信息。要输入的详细信息是









当用户输入所有详细信息并单击按钮时,我将创建包含的xml文件用户详细信息,例如

I have a HTML page(A Form) where user will enter his details. Details to enter are
Name
age
salary
state
City
Now when user enters all details and click Button then I will create xml file containing the user details like

<root>
<name>abc</name>
<age>40</age>
<salary>20000</age>
<state>xyz</state>
<city>abc</city>
</root>



在此之后,我想使用 XMLSignature签署此xml文件。我只想签署两个文件元素,即名称和工资元素使用XSLT转换以及一些摘要和签名方法。


After this I want to sign this xml file using XMLSignature. I want to sign only two elements of document i.e name and salary element using XSLT transform and some digest and signature method.

我的问题是如何在xmlsignature的transform元素中使用XSLT变换。实现这一目标的最佳方法是什么?

My question is how to use the XSLT transform in our xmlsignature's transform element. What is the best way to achieve this?

用户在HTML页面中按另一个按钮时还有一个问题,他应该是显示已签名的元素,即应向用户显示名称和工资。我怎样才能做到这一点。 XSLT转换也会在这里发挥作用吗?

One more issue when the user presses Another Button in HTML page, He should be shown the elements which are signed i.e name and salary should be displayed to user. How can I achieve that. Will XSLT transform plays a role here also?

注意我正在使用Java库创建XMLSignature

推荐答案

参考,您可以尝试类似以下的方法:

Making reference to http://www.w3.org/TR/xmldsig-filter2/#sec-Examples, you might try an approach similar to the following:

<dsig:Transforms>
  <dsig:Transform Algorithm="http://www.w3.org/2002/06/xmldsig-filter2">
    <dsig-xpath:XPath Filter="union"> /root/name </dsig-xpath:XPath>
    <dsig-xpath:XPath Filter="union"> /root/salary </dsig-xpath:XPath>
  </dsig:Transform>
</dsig:Transforms>

这篇关于xmlsignature形式的XSLT转换,是xmldocument的一部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 05:00