I have an xml file that looks like this:
<args>
<sometag value="abc">
<anothertag value="def">
<atag value="blah">
</args>
keep in mind that tag names within args could be named anything (I don't know ahead of time) Now i have this xml file stored in a variable called $data which I loaded using a document() call in the xslt stylesheet (its not the backing data for the xslt file)
I want to take that data and produce the following output: sometag=abc&anothertag=def&atag=blah
so (a very simplified verison looks like this:
<xsl:template>
<xsl:variable name="data" select="document('/path/to/xml')" />
<xsl:call-template name='build_string'>
<xsl:with-param name='data' select='$data' />
</xsl:call-template>
</xsl:template>
<!-- here is where i need help -->
<xsl:template name="build_string">
<xsl:param name='data'>
<xsl:value-of select='name($data/.)' />=<xsl:value-of select='$data/@value' />
<xsl:if test='$data/following-sibling::node()'>
<xsl:text>&</xsl:text>
<xsl:call-template name="build_str">
<xsl:with-param name="data" select='$nodes/following-sibling::node()' />
</xsl:call-template>
</xsl:if>
</xsl:template>
This almost works but it also prints text nodes from the input file and I don't want to match text nodes..