|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XSLT real time use of XML to XML Transformation (U
Hi Heath (Allison?),
I'm afraid I can't debug your code since the approach you take is so far from the one I would prefer ... which is simpler and easier, but which might come across as an "advanced" technique to an XSLT newcomer. Briefly, it is to see your problem as a grouping problem (which it is). If it were me, I'd make a key like so: <xsl:key name="data-by-agent" match="CLIENTDATA" use="generate-id(preceding-sibling::USER[1])"/> Then I'd do something like: <xsl:template match="CLIENTDATA"/> <!-- suppresses processing of CLIENTDATA nodes on regular traversal --> <xsl:template match="USER">
<AGENT>
<xsl:variable name="thisagentdata"
select="key('data-by-agent', generate-id())"/>
<!-- the variable is bound to the three CLIENTDATA nodes belonging to
this USER -->
<AGENTNAME><xsl:value-of select="."/></AGENTNAME>
<AGENTID>
<xsl:value-of select="$thisagentdata[1]"/>
</AGENTID>
<AGENTAGE>
<xsl:value-of select="$thisagentdata[2]"/>
</AGENTAGE>
<AGENTSTATUS>
<xsl:value-of select="$thisagentdata[3]"/>
</AGENTSTATUS>
</AGENT>
</xsl:template>An excellent guide to grouping problems may be found at www.jenitennison.com. Using keys (the <xsl:key/> declaration and the key() function) are documented in the spec and in any reasonably decent how-to book on XSLT. I hope this helps, Wendell At 04:29 PM 6/10/2003, you wrote: I've made some progress hacking away at my problem using information I found in the archives, but I'm still stuck on a few points....
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








