[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: problem chain templates together

Subject: Re: problem chain templates together
From: Xiaocun Xu <xiaocunxu@xxxxxxxxx>
Date: Thu, 26 Jul 2001 12:51:37 -0700 (PDT)
problem chain
After some re-design, I was able to accomplish what I
needed to do.  Please ignore the request.

Thanks,
Xiaocun

--- Xiaocun Xu <xiaocunxu@xxxxxxxxx> wrote:
> Hi,
> 
> I have a problem figure out how to chain my
> templates
> together.  My XML has alternating organization and
> user  sections, where there could be multiple user
> records.  One organization and the following user
> section belongs to the same organization and
> therefore
> processed together.  My strategy is to search for
> the
> unique section headings, and then process the rows
> after the heading, **but before the start of the
> next
> heading**.  The last part is where I can't seem to
> figure out.  Following are the XML and XSL I
> currently
> have:
> 
> XML:
> <row row="1">
> 	<cell column="1">*SupplierOrganizationCode</cell>
> 	<cell column="2">SupplierName</cell>
> 	<cell column="3">Address</cell>
> </row>
> <row row="2">
> 	<cell column="1">s1</cell>
> 	<cell column="2">test name for s1</cell>
> 	<cell column="3">5 Brown Road, Boston, MA</cell>
> </row>
> <!-- row 3 is empty to separate the sections -->
> <row row="4">
> 	<cell column="1">EmailAddress</cell>
> 	<cell column="2">WorkPhoneNumber</cell>
> </row>
> <!-- could have n contacts for s1, this example
> shows
> 2 -->
> <row row="5">
> 	<cell column="1">test1@xxxxxx</cell>
> 	<cell column="2">(800) 837-8171</cell>
> </row>
> <row row="6">
> 	<cell column="1">test2@xxxxxx</cell>
> 	<cell column="2">(800) 837-8172</cell>
> </row>
> <!-- row 7 is empty to separate the sections -->
> <row row="8">
> 	<cell column="1">*SupplierOrganizationCode</cell>
> 	<cell column="2">SupplierName</cell>
> 	<cell column="5">Address</cell>
> </row>
> <row row="9">
> 	<cell column="1">s2</cell>
> 	<cell column="2">test name for s2</cell>
> 	<cell column="5">200 Wheeler Road, Boston,
> MA</cell>
> </row>
> <!-- row 10 is empty to separate the sections -->
> <row row="11">
> 	<cell column="1">EmailAddress</cell>
> 	<cell column="2">FaxNumber</cell>
> 	<cell column="3">WorkPhoneNumber</cell>
> </row>
> <!-- could have n contacts for s2, this example
> shows
> 1 -->
> <row row="12">
> 	<cell column="1">test1@xxxxxx</cell>
> 	<cell column="2">(800) 837-8271</cell>
> </row>
> 
> XSL:
> <xsl:template match="/">
> 	<xsl:apply-templates select="row"
> mode="SupplierHeader"/>
> </xsl:template>
> <xsl:template match="row" mode="SupplierHeader">
> 	<!-- find the Supplier header row.  The first
> element
> is SupplierOrganizationCode or
> *SupplierOrganizationCode -->
> 	<xsl:if test="cell[1] = 'SupplierOrganizationCode'
> or
> substring(cell[1], 2) = 'SupplierOrganizationCode'">
> 		<xsl:apply-templates
> select="following-sibling::row[@row = node()/@row +
> 1]" mode="Supplier"/>
> 	</xsl:if>
> </xsl:template>
> <xsl:template match="row" mode="Supplier">
> 	<!-- display supplier info omitted -->
> 	<xsl:apply-templates
> select="following-sibling::row"
> mode="ContactHeader"/>
> </xsl:template>
> <xsl:template match="row" mode="ContactHeader">
> 	<!-- find the Contact header row.  The first
> element
> is EmailAddress or *EmailAddress -->
> 	<xsl:if test="cell[1] = 'EmailAddress' or
> substring(cell[1], 2) = 'EmailAddress'">
> 		<xsl:apply-templates
> select="following-sibling::row[@row &gt; node()/@row
> and @row &lt; ???]" mode="Contact"/>
> 	</xsl:if>
> </xsl:template>
> <xsl:template match="row" mode="Contact">
> 	<!-- display contact info omitted -->
> </xsl:template>
> 
> In ContactHeader template, the ??? in
> xsl:apply-templates is what I can't seem to figure
> out.  Any help would be very much appreciated.
> 
> Thanks,
> Xiaocun
> 
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute
> with Yahoo! Messenger
> http://phonecard.yahoo.com/
> 
>  XSL-List info and archive: 
> http://www.mulberrytech.com/xsl/xsl-list
> 


__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.