开发者

XSLT with nodeset as external parameter

I'm passing XML nodes to my JAVA transformer:

transformer.setParameter("orset", qRes);

The contents of qRes is similar to this:

<DOCTYPES>
    <SUBTYPE>Passport</SUBTYPE>
    <DOCTYPE>Proof of identity</DOCTYPE>
</DOCTYPES>
<DOCTYPES>
    <SUBTYPE>Driving License</SUBTYPE>
    <DOCTYPE>Proof of address</DOCTYPE>
</DOCTYPES>

I have a global parameter declared in my XSL file:

<xsl:param name="orset"/>

Can I access specific values from the parameter something like this:

<xsl:for-each SELECT="$orset/DOCTYPES">
<xsl:value-of select="$orset/DOCTYPES/DOCTYPE"/>
...开发者_StackOverflow

Or what would be the proper way of doing this?

Many thanks!


You are best to use the eXslt node-set function...

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:exsl="http://exslt.org/common"
  extension-element-prefixes="exsl"
  version="1.0">
 ...
 <xsl:value-of select="exsl:node-set($orset)/DOCTYPES"/>
  ...
</xsl:stylesheet>

There are alternative node-set functions available based on your processor etc, they are all listed in the below reference.

http://www.xml.com/pub/a/2003/07/16/nodeset.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜