xsl-list
[Top] [All Lists]

Re: [xsl] Merging of Files According To A List Using Collection

2008-06-11 03:26:18
Thanks!

I was matching every single character in my list that is not \r\n thats why my xpath does not return anything. I change my xsl:copy instruction to:

<xsl:copy-of select="saxon:discard-document(collection(concat($dir,'? select=*.xml;recurse=yes;on-error=ignore'))[div[(_at_)id=$title]])"/>

I'm using saxon:discard-document so that I would not get an Out of Memory error. The files when merge gets up to 49Mb.

Again thanks,
-- Jeff

On 06 11, 08, at 6:10 PM, Michael Kay wrote:

Your regular expression

'^[\r\n]'

looks wrong. Try

'(\r?\n)+'

or more simply

'\s+'

Michael Kay
http://www.saxonica.com/

-----Original Message-----
From: Jeff Sese [mailto:jeferson(_dot_)sese(_at_)asiatype(_dot_)com]
Sent: 11 June 2008 11:02
To: XSL List List
Subject: [xsl] Merging of Files According To A List Using Collection

Hi,

I have a file that list of ids that is used to determine to
order of merging of some file:

id1
id2
id3

The files that need to merged has a structure like:

<div id="id1">
        <!-- some content -->
</div>

I'm merging them using the collection() function in this xsl file:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="2.0" xmlns:saxon="http://saxon.sf.net/";
xmlns:xs="http:// www.w3.org/2001/XMLSchema">
        <xsl:param name="dir" as="xs:string"
select="'file:///Users/jeffsese/
RND/Berichtigungsliste/Merging/Ostraka'"/>
        <xsl:template name="main" exclude-result-prefixes="#all">
                <div type="Papyri">
                        <xsl:for-each select="for $x in
collection(concat($dir,'?
select=*.xml;recurse=yes;on-error=ignore')) return
saxon:discard- document($x)">
                                <xsl:copy-of select="."/>
                        </xsl:for-each>
                </div>
        </xsl:template>
</xsl:stylesheet>

How can I make the insertion follow the order that is
indicated in my text file? I tried this but I can't get any output:

<xsl:variable name="id" as="xs:string*"
select="tokenize(unparsed-text ($pathOfTextFile, 'UTF-8'),
'^[\r\n]')"/> <xsl:for-each select="$id">
        <xsl:variable name="myId" as="xs:string" select="."/>
        <xsl:copy-of select="collection(concat($dir,'?
select=*.xml;recurse=yes;on-error=ignore'))/div[(_at_)id=$myId]"/>
</xsl:for-each>

Thanks,
-- Jeff


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


Jeferson L. Sese
jeferson dot sese at asiatype dot com
Asiatype Inc.
Suite 114 Columbia Tower
Ortigas Ave., Greenhills
Mandaluyong City 1550 Philippines
Tel: +632-744-6262
Mobile: +63927-671-7901




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>