Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xsl] document function and counting

From: "Michael Kay" <mhkay@------------>
To:
Date: 8/1/2001 8:26:00 AM
I think the best answer is to combine the two documents into a single tree
(using xsl:copy-of), and then process that tree using the node-set()
extension function:

<xsl:variable name="combined">
  <a>
    <b><xsl:copy-of select="document('1.xml")/></b>
    <b><xsl:copy-of select="document('2.xml")/></b>
  </a>
</xsl:variable>

<xsl:template match="/">
  <xsl:apply-templates select="xx:node-set($combined)"/>
</xsl:template>

<xsl:template match="a/b//item">
  <xsl:number/>
</xsl:template>

Mike Kay
Software AG


> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Christine
> Donica
> Sent: 01 August 2001 16:01
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] document function and counting
>
>
>
>
> I am trying to use the document function to pull in the
> result trees of
> other documents and then I want to number things across the entire new
> document in one pass.
>
> For example say I have a file called master.xml which
> contains uri's to
> other documents called foo1.xml and foo2.xml.  Say foo1.xml
> and foo2.xml
> each contain a list of <item> tags.
>
> I want the output of the transformation to be a document
> which contains
> all of the <item>s of both foo1.xml and foo2.xml AND I want
> to number them
> continuously from the top to the bottom.  I want to do this
> in one pass of
> a stylesheet.
>
> I can pull foo1.xml and foo2.xml into the output file using
> document().
> Also, if all of the items are already in the same document I
> can easily
> number them using the <xsl:number> tag.  However, it is not
> possible to do
> both in the same run of the stylesheet because xsl:number
> does not seem to
> have access to the elements in main.xml and either foo1.xml
> or foo2.xml at
> the same time. So I can reach my goal if I write two
> stylesheets and run
> them one after each other, but I don't want to do that.
>
> Alternatively, I have tried using parameters to pass a number into the
> item template.  However, I don't know how to get this
> information from the
> point where the template matches an <item> in foo1.xml to a
> point where it
> matches <item> in foo2.xml.  That is, I cannot pass parameters up the
> tree.
>
> Could someone please explain how I should do this?  Or, is it even
> possible?
>
> Thank you so much for your time.
>
> Sarah Coppin
>
>
>
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent