hyliandanny Posted September 28, 2009 Share Posted September 28, 2009 Hello.I have an XML file which eventually leads to something like this: <function> <parameter name="param1">Param1 description.</parameter> <parameter name="param2">Param2 description here!</parameter> <parameter name="param3">Param3 does something else, maybe...</parameter> <returnValue>Returns true if Danny gets it right.</returnValue></function><function> .. (similar) ..</function> By iterating through each <parameter> in a for-each loop -- per function, which is in its own loop -- I am able to get any parameters the function may have, whether it be 0, 1, or 50 of 'em. My problem comes when I use the following XSLT code to get the values: <xsl:for-each select="parameter"> <xsl:valueof select="@name"/> <xsl:value-of select="../parameter"></xsl:for-each><xsl:value-of select="returns"/> This is leading to no output of the <parameter> value itself. If you're using what I've posted, then I'm looking for "Param1 description", "Param2 description here!", etc. Instead, with the above XSLT file -- directed at "../parameter" after much trial and error -- I find myself just seeing:Param1 descriptionParam1 description... (continues for each <parameter> tag)How can I access the value of the node used in the for-each loop without referencing up such that I end up at the first node repeatedly, instead drawing the value of each node iterated through? Link to comment Share on other sites More sharing options...
hyliandanny Posted September 29, 2009 Author Share Posted September 29, 2009 The solution is to use ".". That is,[codeblock]<xsl:value-of select=".">[/codeblock]This will result in each value of the parameter being returned, as I've been told it can be considered as a "this" equivalent in low-level languages such as C# and C++. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.