#381 make input file name accessible to teitoX stylesheets

closed-fixed
5
2012-09-09
2012-09-06
No

The presence of --profiledir and --profile suggests to me that the teitoX tools were designed to allow customization by users. That is, someone could create a new profile for their own project and get teitodocx, for instance, to use this new profile. This profile could contain a customized to.xsl.

I've been doing just that with one of my projects. It so happens that I'd like to use base-uri() to compute the name of an auxiliary file. The details are not important but the general idea is for instance if I execute:

$ teitodocx --profiledir=wherever --profile=custom blah.xml

I'd like the to.xsl stylesheet in custom to compute the name blah.aux.xml from blah.xml and do something with it.

What I want to do does not appear straightforwardly doable right now. This is because the input file blah.xml is copied into a temporary directory as tmp2.xml. Consequently to.xsl has no access to the original file name. There is an inputDir parameter passed to to.xsl but no corresponding inputFile parameter.

In my case, I can work around the problem by having a processing step prior to invoking teitodocx which would effectively import blah.aux.xml into blah.xml. However, it is not clear to me that this solution will work in every case someone wants to.xsl to read data from a file other than the original input file.

Discussion

  • Sebastian Rahtz

    Sebastian Rahtz - 2012-09-07

    I agree, this is a problem. you need access to that base-uri

    I'll have to play around

     
  • Sebastian Rahtz

    Sebastian Rahtz - 2012-09-07
    • assigned_to: nobody --> rahtz
     
  • Louis-Dominique Dubeau

    At some point in my investigations, I've changed the build so that base-uri() would return the name of the original file passed to teitodocx. I'm attaching a patch (named tei-patch.txt) showing what I changed.

    However, as soon as there is an odd transformation, we're back to square one. I don't know whether that's a big problem though because I never invoke the teitoX tools with --odd so I don't know what the use cases are, etc.

     
  • Sebastian Rahtz

    Sebastian Rahtz - 2012-09-09
    • labels: --> XSLT Stylesheets: New or Changed Feature
    • status: open --> closed-fixed
     
  • Sebastian Rahtz

    Sebastian Rahtz - 2012-09-09

    I am not convinced by your patch, because of the ODD processing. So instead I have
    passed an extra parameter to teitodocx.xsl called "inputFile", which has the full path name of the original file. I think this will let you do the work you need.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks