Jump to content

How do I process a nodeset stored within an XSL variable


javajoemorgan

Recommended Posts

I have an XSL variable containing a list of names for which I need to transform and set values. The XSL variable contains a nodeset:

  <headers>	<header>Accept-Language</header>	<header>UA-CPU</header>	<header>User-Agent</header>  </headers>

I need to transform it into:

	<header name="Accept-Language">value</header>	<header name="UA-CPU">value</header>	<header name="User-Agent">value</header>

I just don't know how to write the:

  <xsl:for-each select="????">  </xsl:for-each>

Link to comment
Share on other sites

The short answer is that with XSLT 1.0, you can't.The longer answer is with XSLT 2.0 you can, and with XSLT 1.0, you can do that by first casting the variable to a node-set with the exsl:node-set() function.

Link to comment
Share on other sites

The short answer is that with XSLT 1.0, you can't.The longer answer is with XSLT 2.0 you can, and with XSLT 1.0, you can do that by first casting the variable to a node-set with the exsl:node-set() function.
Interesting... because while waiting for an answer, I took a shot at this:
	<xsl:for-each select="$headerNames//header">	   // blah blah blah	</xsl:for-each>

And that works... I'm pretty sure I'm using a 1.0 processor without access to the exsl:node-set function.Is it a miracle... did I get lucky... or is there more to my XSL processor than meets the eye?

Link to comment
Share on other sites

Interesting... because while waiting for an answer, I took a shot at this:
	<xsl:for-each select="$headerNames//header">	   // blah blah blah	</xsl:for-each>

And that works... I'm pretty sure I'm using a 1.0 processor without access to the exsl:node-set function.Is it a miracle... did I get lucky... or is there more to my XSL processor than meets the eye?

I think MSXML implements this in contrast with the XSLT 1.0 spec. Is that your XSLT processor?
Link to comment
Share on other sites

I think MSXML implements this in contrast with the XSLT 1.0 spec. Is that your XSLT processor?
No, I think mine is Java Based.... I know talking to me over many posts you must think I'm pretty stupid for not knowing much about my environment... but I work with an IBM DataPower appliance... that can only be controlled through XSLT, and, they don't tell us a whole lot about how it works under the covers. So, I can only guess.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...