[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
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:
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.
At 04:29 PM 6/10/2003, you wrote:
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Re: [xsl] XSLT real time use of XML to XML Transformation (Updated Querry)
Subject: Re: [xsl] XSLT real time use of XML to XML Transformation (Updated Querry) From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Tue, 10 Jun 2003 18:18:54 -0400 |
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....
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] XSLT real time use of XML to , HEATH ALLISON | Thread | RE: [xsl] XSLT real time use of XML, HEATH ALLISON |
Re: [xsl] Re: Announcement: FXSL ve, Colin Paul Adams | Date | [xsl] Re: Re: Announcement: FXSL ve, Dimitre Novatchev |
Month |