Adobe AEM表单:在XSLT源模板中插入XML变量
我正在使用一个使用XSLT服务活动转换XML的流程。它将需要使用普通XML源以及字符串和XML类型的流程变量。我的问题是,我不知道如何将XML类型的流程变量插入XSLT源模板。插入字符串类型的变量没有问题 这是我的样式表的插入部分:Adobe AEM表单:在XSLT源模板中插入XML变量,xml,xslt,xslt-1.0,aem,livecycle,Xml,Xslt,Xslt 1.0,Aem,Livecycle,我正在使用一个使用XSLT服务活动转换XML的流程。它将需要使用普通XML源以及字符串和XML类型的流程变量。我的问题是,我不知道如何将XML类型的流程变量插入XSLT源模板。插入字符串类型的变量没有问题 这是我的样式表的插入部分: <xsl:variable name="stringvariable" select="'{$/process_data/@stringVariable$}'"/> <xsl:variable name="externalNodes" sele
<xsl:variable name="stringvariable" select="'{$/process_data/@stringVariable$}'"/>
<xsl:variable name="externalNodes" select="'{$/process_data/inputNodeNames$}'"/>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:variable name="stringvariable" select="'{$/process_data/@stringVariable$}'"/>
<xsl:variable name="externalNodes" select="'{$/process_data/inputNodeNames$}'"/>
<xsl:variable name="internalNodes">
<root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<block>$.Formularmetadata</block>
<block>$.Sorteringsdata</block>
<block>$.Metadata</block>
<block>$.Verksamhetsdata</block>
</root>
</xsl:variable>
<!-- Identity rule.-->
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<!-- Rewrite attribute ref to work with new XML.-->
<xsl:template match="*[local-name()='bind']/@ref">
<xsl:value-of select="$stringvariable "/>
<xsl:value-of select="' Internal'"/><xsl:value-of select="count(exsl:node-set($internalNodes)/root/block)"/>
<xsl:value-of select="' External'"/><xsl:value-of select="count(exsl:node-set($externalNodes)/root/block)"/>
</xsl:template>
</xsl:stylesheet>
我尝试在变量元素的开始标记和结束标记之间插入数据,但没有帮助。插入字符串变量,然后成功打印以进行验证
我还创建了一个局部变量(与外部变量的内容相同),以供参考:
<xsl:variable name="internalNodes">
<root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<block>$.Formularmetadata</block>
<block>$.Sorteringsdata</block>
<block>$.Metadata</block>
<block>$.Verksamhetsdata</block>
</root>
</xsl:variable>
$.Formularmetadata
$.Sorteringsdata
美元.元数据
$Verksamhetsdata
然后对模板中的两个XML变量调用count(exsl:node-set()),但只有本地变量的值大于0
我怎样才能让它工作
/学士学位
附:这是完整的XSL样式表:
<xsl:variable name="stringvariable" select="'{$/process_data/@stringVariable$}'"/>
<xsl:variable name="externalNodes" select="'{$/process_data/inputNodeNames$}'"/>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:variable name="stringvariable" select="'{$/process_data/@stringVariable$}'"/>
<xsl:variable name="externalNodes" select="'{$/process_data/inputNodeNames$}'"/>
<xsl:variable name="internalNodes">
<root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<block>$.Formularmetadata</block>
<block>$.Sorteringsdata</block>
<block>$.Metadata</block>
<block>$.Verksamhetsdata</block>
</root>
</xsl:variable>
<!-- Identity rule.-->
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<!-- Rewrite attribute ref to work with new XML.-->
<xsl:template match="*[local-name()='bind']/@ref">
<xsl:value-of select="$stringvariable "/>
<xsl:value-of select="' Internal'"/><xsl:value-of select="count(exsl:node-set($internalNodes)/root/block)"/>
<xsl:value-of select="' External'"/><xsl:value-of select="count(exsl:node-set($externalNodes)/root/block)"/>
</xsl:template>
</xsl:stylesheet>
$.Formularmetadata
$.Sorteringsdata
美元.元数据
$Verksamhetsdata
在经历了更多的经验之后,我发现如果我使用字符串变量来传输数据,它将无法工作。我将其插入开始标记和结束标记之间,然后在将其嵌入exsl:node-set()后使用它,使其作为XML工作
插入点:
<xsl:variable name="topNodes">'{$/process_data/@xmlTopNodes$}'</xsl:variable>
“{$/process\u data/@xmlTopNodes$}”
模板中的用法:
<xsl:variable name="match" select="exsl:node-set($topNoder)/root/block[starts-with(current(), .)]"/>