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

Re: Chunking xml into single-topic docs

Subject: Re: Chunking xml into single-topic docs
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 24 Feb 2005 12:42:08 -0500
chunking xml
Marcy,

The trouble you are having is resulting from this bit of code:

At 12:01 PM 2/24/2005, you wrote:
                <xsl:variable name="title">
                <xsl:choose>
                  <xsl:when test="contains($file_title,'_')">
                    <xsl:value-of
select="escape-uri(substring-before($file_title,'_'),true())"/>
                   </xsl:when>
                  <xsl:otherwise>
             <xsl:value-of select="escape-uri($file_title,true())"/>
                  </xsl:otherwise>
                </xsl:choose>
                </xsl:variable>

                <xsl:variable name="title2">
                <xsl:choose>
                  <xsl:when test="contains($title,' ')">

                <xsl:value-of select="substring-before($title,' ')"/>
                        <xsl:text>.xml</xsl:text>
                  </xsl:when>
                  <xsl:when test="contains($title,'/')">

                <xsl:value-of select="substring-before($title,'/')"/>
                        <xsl:text>.xml</xsl:text>
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:value-of select="$title"/>
                        <xsl:text>.xml</xsl:text>
                  </xsl:otherwise>
                </xsl:choose>
                </xsl:variable>

This is what implements the logic you have described. Since the declaration of $file_title has already converted new-lines into '_', these variable declarations serve basically to trim the name further, ultimately taking whatever string is available up to '_' or ' ' as a code to use for the filename.


The logic is implemented well enough, but of course it's faulty given the requirement, for the reason you outline: files stepping on each other because names are not unique. So you need some other way of generating a unique code for each file.

This is a very open-ended requirement, and only you decide what kind of code would serve. Any ideas? If you were to ask the list what we have done in analogous situations, I'm sure there would be many answers. In particular, the questions come up of whether you need the file names to be transparent, and how long you are willing to let them get. (It's not hard to make them unique and either short or transparent, but generally harder to do all of these together.) Note that until a functional specification is clear, this isn't really an XSLT question. :->

I hope this helps,
Wendell




___&&__&_&___&_&__&&&__&_&__&__&&____&&_&___&__&_&&_____&__&__&&_____&_&&_
"Thus I make my own use of the telegraph, without consulting
the directors, like the sparrows, which I perceive use it
extensively for a perch." -- Thoreau


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.