I can't figure out how to inserting process variables of type XML into XSLT Source templates. I have no problem inserting variables of type String.
This is the insert part of my stylesheet:
<xsl:variable name="stringvariable" select="'{$/process_data/@stringVariable$}'"/>
<xsl:variable name="externalNodes" select="'{$/process_data/inputNodeNames$}'"/>
The string variable is inserted and later printed for verification.
I have also created a local variable (with same contents as external) for reference:
<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>
I then invoke count(exsl:node-set()) on both variable in the template, but only the local have a value over 0.
How can I get this to work?
/BS
PS. This is the full XSL stylesheet:
<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>
Solved! Go to Solution.
Views
Replies
Total Likes
After som more experientation I found that if I use a string variable to transfer the data it seams to work. I insert it between a start- and end-tag and then use it after I have embedded it in exsl:node-set() to make it work as XML.
<xsl:variable name="topNodes">'{$/process_data/@xmlTopNodes$}'</xsl:variable>
Views
Replies
Total Likes
After som more experientation I found that if I use a string variable to transfer the data it seams to work. I insert it between a start- and end-tag and then use it after I have embedded it in exsl:node-set() to make it work as XML.
<xsl:variable name="topNodes">'{$/process_data/@xmlTopNodes$}'</xsl:variable>
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies