Subject: Re: convert large array to several smaller arrays containing max N elements
From: David Everly <deckrider@xxxxxxxxxxxxx>
Date: Wed, 12 Nov 2003 08:12:59 -0700
|
On Tue, Nov 11, 2003 at 06:03:36PM -0500, Wendell Piez wrote:
> Hint: XSLT is not a set of string-writing routines, and it doesn't
> work by writing tags to the output. Instead, it builds trees.
I'm beginning to understand this.
> you want something like
>
> <xsl:template match="/">
> <xsl:for-each select="//WorkOrder/lineService[position() mod 2 = 1]">
> <topgroup>
> <xsl:for-each select=".|following-sibling::lineService[1]">
> <TEABTN>
> <NPA><xsl:value-of
> select="normalize-space(tpExistAcctBillTelNo/npa)"/></NPA>
> <NXX><xsl:value-of
> select="normalize-space(tpExistAcctBillTelNo/nxx)"/></NXX>
> <XXXX><xsl:value-of
> select="normalize-space(tpExistAcctBillTelNo/xxxx)"/></XXXX>
> </TEABTN>
> </topgroup>
> </xsl:for-each>
> </xsl:template>
Yes! This approach works for me and I now see how this can be done.
> The difference between this and what you had is that it specifies a set of
> *nodes* to be added to the result *tree* -- not just write a bunch of tags
> (which hopefully will parse). Not incidentally, the stylesheet template
> itself is well-formed XML, and will parse.
>
> It's completely different from, say, the way Javascript writes HTML tagging
> to browser windows.
Yes, I think this is an important lesson. Thanks again for your help.
Dave.
--
() ASCII ribbon campaign - against HTML email
/\ - against Microsoft attachments
For assistance, see: http://www.expita.com/nomime.html
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|