How to associate file relative to project with transformation scenario

Hi, I want to distribute set of sample XML files and XSLT transformations. I can create project and if I create per-project transformation scenarios those scenarios are saved to project file. But I also want to maintain association between files and transformation scenarios that should be applied on them. However oXygen stores such association against absolute URL of file which doesn't work when project and all files are moved to different computer into different folder. I have tried to modify project file manually to use relative paths and variables like ${pdu}, but oXygen was not able to recognize association then. Is it possible to achieve this in oXygen 10.2? TIA, Jirka -- ------------------------------------------------------------------ Jirka Kosek e-mail: jirka@kosek.cz http://xmlguru.cz ------------------------------------------------------------------ Professional XML consulting and training services DocBook customization, custom XSLT/XSL-FO document processing ------------------------------------------------------------------ OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 member ------------------------------------------------------------------

Hello, You can create a document type in Preferences -> Document Type Association for the XML files. A rule for associating an XML file with the document type can specify the * and ? characters and editor variables in the field File Name. The XSLT transformations should be added to the Transformation section of the document type. For distributing the document type you can build a zip with the .framework file and the XSLT stylesheets or you can save the document type at project level which will save it in the current project opened in the Project view. Regards, Sorin Jirka Kosek wrote:
Hi,
I want to distribute set of sample XML files and XSLT transformations. I can create project and if I create per-project transformation scenarios those scenarios are saved to project file. But I also want to maintain association between files and transformation scenarios that should be applied on them. However oXygen stores such association against absolute URL of file which doesn't work when project and all files are moved to different computer into different folder. I have tried to modify project file manually to use relative paths and variables like ${pdu}, but oXygen was not able to recognize association then.
Is it possible to achieve this in oXygen 10.2?
TIA,
Jirka

Sorin Ristache wrote:
You can create a document type in Preferences -> Document Type Association for the XML files. A rule for associating an XML file with the document type can specify the * and ? characters and editor variables in the field File Name. The XSLT transformations should be added to the Transformation section of the document type. For distributing the document type you can build a zip with the .framework file and the XSLT stylesheets or you can save the document type at project level which will save it in the current project opened in the Project view.
Thanks, I see. But I need reverse, I want to associate XML files to XSLT transformations -- I have several transformations that operate on the same data. Is there any way for this? Thanks, Jirka -- ------------------------------------------------------------------ Jirka Kosek e-mail: jirka@kosek.cz http://xmlguru.cz ------------------------------------------------------------------ Professional XML consulting and training services DocBook customization, custom XSLT/XSL-FO document processing ------------------------------------------------------------------ OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 member ------------------------------------------------------------------

Hello, Do you mean that for a set of XML files you need to apply more than one XSLT transformation to each XML file of the set for generating different outputs from the same XML file? A document type is useful in this case but you have to switch to other scenario of the document type when you want to change the transformation that is applied to the same XML file. The scenarios of the document type of the current XML document are preceded by an icon with a key symbol in the dialog box with the list of scenarios. This switch is necessary because only one scenario (that specifies an XSLT stylesheet) can be associated with an XML file. You cannot save and distribute to other users more than one scenario association for the same XML file. This is true also for the other type of scenarios: you cannot associate more than one scenario (that specifies an XML file) to the same XSLT stylesheet. If this is not what you want maybe an example will help me understand your use case. Regards, Sorin Jirka Kosek wrote:
Thanks, I see. But I need reverse, I want to associate XML files to XSLT transformations -- I have several transformations that operate on the same data. Is there any way for this?
Thanks,
Jirka

Sorin Ristache wrote:
scenarios. This switch is necessary because only one scenario (that specifies an XSLT stylesheet) can be associated with an XML file. You cannot save and distribute to other users more than one scenario association for the same XML file. This is true also for the other type of scenarios: you cannot associate more than one scenario (that specifies an XML file) to the same XSLT stylesheet.
If this is not what you want maybe an example will help me understand your use case.
I want to distribute examples of XML and XSLT files to students of XSLT class. I have several sample XML documents. For each such XML file I have several transformations which show different XSLT language constructs. When student opens some XSLT file he should by able to run it against corresponding input XML data just by pressing "Apply Transformation Scenario" button. This is what I would like to accomplish. I can easily accomplish this on my computer by associating XML file to each transformation. Problem is that transformation in project file is identified by absolute path so when I move project file to another computer associations are lost. Jirka -- ------------------------------------------------------------------ Jirka Kosek e-mail: jirka@kosek.cz http://xmlguru.cz ------------------------------------------------------------------ Professional XML consulting and training services DocBook customization, custom XSLT/XSL-FO document processing ------------------------------------------------------------------ OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 member ------------------------------------------------------------------

Hello, If the files that you distribute are located in the folder of the project file or in subfolders of this folder the associations between scenarios and transformed files are saved with relative paths. If you saved the scenarios at project level you can look at the scenario.associations entry. I think you have ${currentFileURL} in the XSL URL field of the scenario associated with an XSLT stylesheet and this saves the URL of the stylesheet in the scenario, that is the absolute path on your computer. You should use a variable like ${pdu} (project directory as URL) because it is not expanded when the scenario is saved which means you can distribute the same structure of files as on your computer. It does not matter in what base directory the users will place the project file and the transformed files on their computers because the variable is expanded when the scenario is executed. Regards, Sorin Jirka Kosek wrote:
Sorin Ristache wrote:
scenarios. This switch is necessary because only one scenario (that specifies an XSLT stylesheet) can be associated with an XML file. You cannot save and distribute to other users more than one scenario association for the same XML file. This is true also for the other type of scenarios: you cannot associate more than one scenario (that specifies an XML file) to the same XSLT stylesheet.
If this is not what you want maybe an example will help me understand your use case.
I want to distribute examples of XML and XSLT files to students of XSLT class. I have several sample XML documents. For each such XML file I have several transformations which show different XSLT language constructs. When student opens some XSLT file he should by able to run it against corresponding input XML data just by pressing "Apply Transformation Scenario" button. This is what I would like to accomplish.
I can easily accomplish this on my computer by associating XML file to each transformation. Problem is that transformation in project file is identified by absolute path so when I move project file to another computer associations are lost.
Jirka
------------------------------------------------------------------------
_______________________________________________ oXygen-user mailing list oXygen-user@oxygenxml.com http://www.oxygenxml.com/mailman/listinfo/oxygen-user

Sorin Ristache wrote:
I think you have ${currentFileURL} in the XSL URL field of the scenario associated with an XSLT stylesheet and this saves the URL of the stylesheet in the scenario, that is the absolute path on your computer. You should use a variable like ${pdu} (project directory as URL) because it is not expanded when the scenario is saved which means you can distribute the same structure of files as on your computer.
Many thanks, this made the trick. Jirka -- ------------------------------------------------------------------ Jirka Kosek e-mail: jirka@kosek.cz http://xmlguru.cz ------------------------------------------------------------------ Professional XML consulting and training services DocBook customization, custom XSLT/XSL-FO document processing ------------------------------------------------------------------ OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 member ------------------------------------------------------------------

I get proper output when running the XML and XSLT-FO style sheet as an Oxygen 10.1 Scenario. However, it fails when run as a batch file with the complaint: SystemId Unknown; Line #206; Column #78; Could not find function: current-group I am assuming that the Scenario's built-in FOP deals with my XSLT Version 2 style sheet and the bat file calls my local copy of FOP and does not. I am unsure as how to proceed. Is there a new FOP that handles XSLT-Version 2? If so, what should my bat file look like? Or, is there a way for my bat file to call the built-in FOP? My bat file: fop -d -c fopConfiguration.xml -xml work\21Grouped.xml -xsl XSLT\22HeadingPdf.xsl -pdf work\headings.pdf I would send you the Scenario, but I do not know how to print it. The Scenario specifies the built-in FOP. Thanks, Mark

Hello, fop.bat adds Xalan to the classpath which is an XSLT 1.0 transformer. You have to edit fop.bat and replace Xalan with Saxon 9. For example you can copy saxon9.jar from the Saxon 9 distribution from Saxonica to [FOP-install-folder]/lib or you can copy saxon9sa.jar from [Oxygen-install-folder]/lib to [FOP-install-folder]/lib. Replace in fop.bat the line set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xalan-2.7.0.jar with the line: set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\saxon9sa.jar If you use saxon9sa.jar without a license for Saxon SA (schema aware) the transformer of saxon9sa.jar will display a warning and run in basic mode (Saxon B, like saxon9.jar) but it runs your XSLT 2.0 transformation without problems if the transformation is not schema aware. If your XSLT 2.0 transformation is schema aware you need a license for Saxon SA from Saxonica for using it from command line. Regards, Sorin Mark Wilson wrote:
I get proper output when running the XML and XSLT-FO style sheet as an Oxygen 10.1 Scenario. However, it fails when run as a batch file with the complaint: SystemId Unknown; Line #206; Column #78; Could not find function: current-group
I am assuming that the Scenario's built-in FOP deals with my XSLT Version 2 style sheet and the bat file calls my local copy of FOP and does not. I am unsure as how to proceed. Is there a new FOP that handles XSLT-Version 2? If so, what should my bat file look like? Or, is there a way for my bat file to call the built-in FOP?
My bat file: fop -d -c fopConfiguration.xml -xml work\21Grouped.xml -xsl XSLT\22HeadingPdf.xsl -pdf work\headings.pdf
I would send you the Scenario, but I do not know how to print it. The Scenario specifies the built-in FOP.
Thanks, Mark

Worked like a charm. Thanks. Oddly enough, doing what you suggested exposed two syntax errors in the style sheet that the bat file run did not seem to care about. Mark -------------------------------------------------- From: "Sorin Ristache" <sorin@oxygenxml.com> Sent: Tuesday, May 05, 2009 12:32 AM To: <oxygen-user@oxygenxml.com> Subject: Re: [oXygen-user] Success with Scenario, failure in bat file
Hello,
fop.bat adds Xalan to the classpath which is an XSLT 1.0 transformer. You have to edit fop.bat and replace Xalan with Saxon 9. For example you can copy saxon9.jar from the Saxon 9 distribution from Saxonica to [FOP-install-folder]/lib or you can copy saxon9sa.jar from [Oxygen-install-folder]/lib to [FOP-install-folder]/lib. Replace in fop.bat the line
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xalan-2.7.0.jar
with the line:
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\saxon9sa.jar
If you use saxon9sa.jar without a license for Saxon SA (schema aware) the transformer of saxon9sa.jar will display a warning and run in basic mode (Saxon B, like saxon9.jar) but it runs your XSLT 2.0 transformation without problems if the transformation is not schema aware. If your XSLT 2.0 transformation is schema aware you need a license for Saxon SA from Saxonica for using it from command line.
Regards, Sorin
Mark Wilson wrote:
I get proper output when running the XML and XSLT-FO style sheet as an Oxygen 10.1 Scenario. However, it fails when run as a batch file with the complaint: SystemId Unknown; Line #206; Column #78; Could not find function: current-group
I am assuming that the Scenario's built-in FOP deals with my XSLT Version 2 style sheet and the bat file calls my local copy of FOP and does not. I am unsure as how to proceed. Is there a new FOP that handles XSLT-Version 2? If so, what should my bat file look like? Or, is there a way for my bat file to call the built-in FOP?
My bat file: fop -d -c fopConfiguration.xml -xml work\21Grouped.xml -xsl XSLT\22HeadingPdf.xsl -pdf work\headings.pdf
I would send you the Scenario, but I do not know how to print it. The Scenario specifies the built-in FOP.
Thanks, Mark
oXygen-user mailing list oXygen-user@oxygenxml.com http://www.oxygenxml.com/mailman/listinfo/oxygen-user
participants (3)
-
Jirka Kosek
-
Mark Wilson
-
Sorin Ristache