Re: Chunking xml into single-topic docs
It's best to mention if you want a XSLT2 solution (as you do). XSLT2 is still in draft form and most people wil assume XSLt1 when replying unless they happen to notice a few XSLT2 constructs in your code. > However, if the first word is the same in more > than one heading (i.e. Product Overview, and Product Specifications) the > first file is overwritten by the second occurrence and the first file > isn't created. Before thinking about the xslt you hav eto decide what you want to do about that, possibilities are 1) use the whole title (and live with spaces in file names) 2) use the whole title but convert spaces to _ or somethinmg else 3) use the first word but append a number product, Product2, Profuct2, etc if it's not the first occurrence... what you actually appear to be douing is normalising teh white space, then converting all spaces to _ and teh taking teh string before _ or / as the file name. It would be possible (using keys, most likely) to discover whether any other nodes would produce the same filename from that procedure and so add a number as suggested in (3) above but there are much simpler ways of generating a unique name (eg either of (1) or (2) above, if you know your titles are unique), or just using or appending the reult of generate-id() which will generate a unique string for each node. But generate-id isn't suitable if you want the file names to be humanly readable or the same each time you process your input file. if you just want to append a number as in (3) something like count(preceding-sibling::OneHead[starts-with(.,$title3)]) might be the number you need (if i understood your code well enough) David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
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