Re: Chunking xml into single-topic docs
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>
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
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format