Code running in OXYGEN correctly but not in altova - xslt

I've an XML document, on which i was running an XSLT.
when i run it in Oxygen, the output is fine, but when i do the same in Altova, it is catching wrong when and giving a buggy output. When i went into the XML engine, it showed it as SAXON HE and in Altova i think it used XALAN, I tried to import the SAXON jar file and tere the parameters expected are %1(XML input), %2(Output File) and %3(XSL), but here the problem is i'm running on an entire set of files from project window.
CAn you please let me know how i can fix this issue and use Saxon to run multiple files.
Thanks

Xalan does not support XSLT2.0. Saxon implements XSLT2.0. The arguments for saxon should be
-xsl:<xsl file> -s:<input xml> -o:<output file>
More here: http://www.saxonica.com/documentation9.5/using-xsl/commandline.html

Related

Executing Ant 'replaceregexp' OK my local machine, but does not work on Microsoft VSTS

Looking for some help with Ant, and specifically the 'replaceregexp' method. Grateful for any and all advice.
Problem
We are using Ant to deploy XML files, and need to remove certain lines of XML before deploying. We are using Microsoft VSTS as our deployment tool.
We need Ant to scan through a number of files, and delete certain rows. Here is a small example of the source we need to analyse and delete:
<classAccesses>
<apexClass>CaseEntitlementMilestoneCalc</apexClass>
<enabled>true</enabled>
</classAccesses>
<classAccesses>
<apexClass>CaseEntitlementMilestoneCalc_Test</apexClass>
<enabled>true</enabled>
</classAccesses>
<classAccesses>
<apexClass>CaseTriggerHandler</apexClass>
<enabled>true</enabled>
</classAccesses>
In this example, we want to find and delete this section of XML:
<classAccesses>
<apexClass>CaseEntitlementMilestoneCalc_Test</apexClass>
<enabled>true</enabled>
</classAccesses>
We are using 'replaceregexp' in Ant to do this. Here is the Ant code we have written to do this:
<replaceregexp match="<classAccesses>\n(.*?)<apexClass>CaseEntitlementMilestoneCalc_Test<\/apexClass>\n(.*?)<enabled>(.*?)<\/enabled>\n(.*?)<\/classAccesses>" replace="" flags="gm" byline="false">
<fileset dir="${src.dir}/profiles" includes="**/*.profile" />
</replaceregexp>
This works fine when I run it on my Mac via Terminal, but when I attempt to run this on VSTS, it does not do the find/replace. Here are the debug logs for each:
My Mac Debug statement
[replaceregexp] Replacing pattern '<classAccesses>\n(.*?)<apexClass>CaseEntitlementMilestoneCalc_Test<\/apexClass>\n(.*?)<enabled>(.*?)<\/enabled>\n(.*?)<\/classAccesses>' with '' in '/Users/david.morris/DevWorkspace/R_Salesforce_Amey/src/profiles/FSL Mobile User.profile' with flags: 'gm'.
[replaceregexp] Found match; substituting
[replaceregexp] File has changed; saving the updated file
VSTS Debug statement
fileset: Setup scanner in dir d:\a\1\s\src\profiles with patternSet{ includes: [**/*.profile] excludes: [] }
Replacing pattern '<classAccesses>\n(.*?)<apexClass>CaseEntitlementMilestoneCalc_Test<\/apexClass>\n(.*?)<enabled>(.*?)<\/enabled>\n(.*?)<\/classAccesses>' with '' in 'd:\a\1\s\src\profiles\AAD JIT Provisioning.profile' with flags: 'gm'.
No change made
Questions
Can anyone see any reason why my Regex might work on my local machine, but not on VSTS?
Are there any other ways that are more fool-proof to do this?
Thank you!
Try to use this code instead:
<classAccesses>.*
.*<apexClass>CaseEntitlementMilestoneCalc_Test<\/apexClass>.*
.*<enabled>(.*?)<\/enabled>.*
.*<\/classAccesses>

docbook style sheets param.xsl

Thank you for the qyuick assistance in finding the Java extension file for Saxon to convert docbook XML into xml.fo. (Question 41362248/docbook-saxon-toolchain-extension-jar-file-cannot-find-same)
Now, I discovered that I unfortunately
cannot find the correct sytle sheets themselves. I tried downloading from the docbook sourceforge project page,
docbook-xsl-doc-1.79.1.zip
from the Files tab, docbook.xsl, 1.79.1, docbook-xsl-1.79.zip
The version I did find that did have docbook.xsl seems to be missing the param.xsl. Here is the error message I got when I attempted
to convert with saxon:
Error at xsl:include on line 28 of file:/home/leffstudent/xsl2/xsl/fo/docbook.xsl:
Failure reading file:/home/leffstudent/xsl2/xsl/fo/param.xsl: /home/leffstudent/xsl2/xsl/fo/param.xsl (No such file or directory)
Transformation failed: Failed to compile stylesheet. 1 error detected.
As I wrote in the above-cited question,
I had all this set up on the Computer Science server at the University where
I teach. Unfortunately, that server was lost. I am trying to recreate
the toolchain.
I use docbook to create the class notes for two of my courses. And
I need this to set up my classes for the Spring 2017 semester.
mzjn provided the solution I needed. I downloaded again
docbook-xsl-1.79.1.zip from sourceforge.net/projects/docbook/files/docbook-xsl/1.79.1
I now created the needed class notes and back at work for the new Spring 2017 semester.
mzjn should make this the official answer so I can accept it.

how to debug xslt in umbraco

I want to debug a xslt used in umbraco (4.0) user control. The xslt is using static .net methods from an assembly say MyAssembly. The xslExtensions.config has been setup with the following entry <ext assembly="/bin/MyAssembly" type="MyAssembly.Utility" alias="MyAssembly.Utility" />
This is referenced and used in the xslt file like
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:MyAssembly.Utility="urn:MyAssembly.Utility"....
-------------------------------------------------->
--------------------------------------------------
<xsl:variable name="Id" select="MyAssembly.Utility:GetQueryStringValue('tlid')"></xsl:variable>
The assembly is copied in the bin folder of the application
The xslt file is quite big and extensively using .net methods. I'm just wondering how can I debug the XSLT by adding breakpoints at various lines. If I run the application just like any .net application and put break points then these breakpoints don't get a hit. If I use the XSLT debug options from the Visual studio menu i.e. Start XSLT Debugging then the debugging starts but I get the error on this line <xsl:variable name="Id" select="MyAssembly.Utility:GetQueryStringValue('tlid')"></xsl:variable>
the error is "Cannot find a script or an extension object associated with namespace 'urn:MyAssembly.Utility'."
Any ideas how can we debug the xslt as explained in this MS visual studio walk-through https://msdn.microsoft.com/en-us/library/ms255602.aspx using .net methods?
I have never used XSLT so i'm probably not going to help with what I'm going to say, but since I've been doing this since day 1 why don't you use break points in Visual Studio to see what your code does? That's the only way I've needed so far in debugging my code.

XSLFO - using xsl:import or xsl:include causes error when creating PDF

I have used XSLFO to generate PDF files, which is working perfectly.
There is some code within the XSLFO that I would like to put into a common file to be used by all the PDF's, but when I add an xsl:import... or xsl:inlcude... at the top of my file, Adobe throws an error saying the file is damaged and cannot be repaired.
Is there something specific I need to do to include another xsl file? I've tried having it in the same root directory but it's still not working.
I have tried adding a full path to the imported xsl files and that works, rather than the relative path, so is this a permissions issue?
Any help would be greatly appreciated.
Thanks
If you're adding an xsl:import or xsl:include to the XSL-FO document, then that's wrong - these declarations should only appear in an XSLT stylesheet file.

libxml2 2.7.8 / libxml++ 2.35 and changes in DTD validation

Lately my Fedora 16 auto-upgraded libxml2 from a previous version to the latest rpm libxml2-2.7.8-8.fc16.i686, and suddenly the dtd validation starts to complain about missing declarations in the DTD file. Before this upgrade everything worked fine. And of course when I disable the validation it also works fine, but that is not the idea. I don't use libxml2 directly, I actually use libxml++ which is a wrapper for libxml2.
I tried to search for some changes in the code of libxml2 that might cause this problem, but the recent changes on the libxml2 site and the changes on the Fedora site for this package do not mention any changes in the DTD code (in recent releases)
The xml message below suddenly is not valid anymore:
<?xml version="1.0"?><!DOCTYPE MYAPP SYSTEM "myapp.dtd"><MYAPP><Command type="Connect"/></MYAPP>
It gives the following error messages:
No declaration for attribute type of element Command
No declaration for element Command
No declaration for element MYAPP
Here is a (stripped) snippet from the myapp.dtd I use:
<!ELEMENT MYAPP (Command|Result)>
<!ELEMENT Command (Parameters?)>
<!ELEMENT Parameters (..a lot of other types and records..)>
<!ATTLIST Command type (None|
Connect|
Disconnect
) "None">
Anybody has some pointers about what might suddenly cause this, does anybody has some pointer/links of the changes in this version. Is it a known bug, any clues??
As suggested I re-compiled (the latest version) libxml2 and no changes, I also recompiled the latest version of libxml++ (2.35-3), it now nicely prints the line number and column of the error, but that is all that has changed. The parser still doesn't accept my (previously accepted) xml file/message.
But libxml 2.7.8 (on Windows) that I use validates your file properly. No messages. First it complained about .. on the third line of your dtd file, so I needed to remove that line. And now it gives a clean output.
So maybe your auto-upgrade actually screwed up the library. If you compile 2.7.8 from source it would be put in /usr/local and would override your current installation. Then you could try again. I don't know how you could try to fix the existing installation. Anyway 2.7.8 release is not responsible for the errors you get.
My testing command line: xmllint ikku.xml -dtdvalid
A quick thought: maybe your parser takes another dtd file into consideration, due to some catalog problems. Try to change the dtd filename.