Re: [xsl] Split files with XSLT2.0 xsl:result-document

Subject: Re: [xsl] Split files with XSLT2.0 xsl:result-document
From: Colin Paul Adams <colin@xxxxxxxxxxxxxxxxxx>
Date: 06 Dec 2004 14:59:23 +0000
>>>>> "Robert" == Robert Soesemann <rsoesemann@xxxxxxxxxxx> writes:


    Robert> E.g. the input file:

    Robert> \in_dir \foo \bar.xml

    Robert> Needs to be splitted to

    Robert> \out_dir \foo \bar1.xml <-- number unnamed fragments
    Robert> \bar2.xml <-- number unnamed fragments \bar#xyz.xml <--

that's not quite right                                 ^
the fragment needs to come after the .xml.

    Robert> use /anchor/@name for name extension
    Robert> Can anybody help me to solve this? Thanks in advance!

You are right that you can do this with xsl:result-document, as the
href attribute can be an attribute-valued template.

But it's not straight-forward, since the name-relationship you want
between the input documents and the output documents is not a relative
URI.

I think you might want to write an xsl:function to help determine the
output name. Then you can use that function within the href="{expression}".

You can use the base-uri function to get the input file URI. 
you can use insert-before to insert the number.
Then if there is an anchor present, use concat to add the fragment-id
-- 
Colin Paul Adams
Preston Lancashire

Current Thread