saxon

“Content is not allowed in prolog” error yet nothing before XML declaration

霸气de小男生 提交于 2019-12-02 01:54:13
问题 First of all I have already exhaustively checked the following questions and this issue does not seem to be the same thing: SAXParseException: Content is not allowed in prolog org.xml.sax.SAXParseException: Content is not allowed in prolog “Content is not allowed in prolog” when parsing perfectly valid XML on GAE Content is not allowed in Prolog SAXParserException These all seem to boil down to 2 things: There is one or more (possibly invisible) chars before the opening <?xml?> tag. There is

XSLT Getting two different output for same input XML for same XSL

大城市里の小女人 提交于 2019-12-01 22:34:43
I have been trying my XSLT code in the online tool [ XSLT 1.0 processor ]: http://www.freeformatter.com/xsl-transformer.html Recently, I had to make use of xs:dateTime and hence started using the tool that uses XSLT 2.0 processor , http://xsltransform.net/ Now, when i was trying to solve a problem, i see that i get different output for the same input XML in these two processors. The code posted here is not the real code i am working on; this is to simulate the weird output i faced. XML: <?xml version="1.0" encoding="UTF-8"?> <items> <book> <title></title> </book> <phone>apple</phone> </items>

Use XSLT to mark up text matching regex?

大兔子大兔子 提交于 2019-12-01 19:56:32
I am trying to use XSLT 2.0 (Saxon-PE 9.6) on an HTML document to create tags that surround all contiguous runs of characters from a specified non-Latin Unicode block (spaces allowed). I need to apply this process to every text() node in the document. I have made some progress with two approaches that use <xsl:analyze-string> and using fn:replace() but I've not been able to arrive at a satisfactory and complete solution. For example, here is some text containing Hindi: Input: <p>चाय का कप means ‘cup of tea’ in हिन्दि.</p> Desired Output: <p><span xml:lang="hi-Deva">चाय का कप</span> means ‘cup

Saxon in Java: XSLT for CSV to XML

谁都会走 提交于 2019-12-01 10:41:26
Mostly continued from this question: XSLT: CSV (or Flat File, or Plain Text) to XML So, I have an XSLT from here: http://andrewjwelch.com/code/xslt/csv/csv-to-xml_v2.html And it converts a CSV file to an XML document. It does this when used with the following command on the command line: java -jar saxon9he.jar -xsl:csv-to-xml.csv -it:main -o:output.xml So now the question becomes: How do I do I do this in my Java code? Right now I have code that looks like this: TransformerFactory transformerFactory = TransformerFactory.newInstance(); StreamSource xsltSource = new StreamSource(new File(

How to use Saxon XPath processor w/o coding in Java

空扰寡人 提交于 2019-12-01 09:25:39
I guess I could make some XSL stylesheet, then use it as a template with parameter option to evaluate XPath expression with Saxon XSLT processor on command line, like: <xsl:template match="/"> <xsl:copy-of select="saxon:evaluate($xpath-param)"/> </xsl:template> Also other possibility is to use their Java API: http://www.saxonica.com/documentation/xpath-api/intro.xml but I don't know Java Is there any way to make Saxon evaluate XPath expression from command line? Shell script would be sufficient, too, if possible Update: Browsing Saxon documentation , I found out about XPathExample sample.

a beginner question on XSLT

只愿长相守 提交于 2019-12-01 08:16:22
I just started learning XSLT,now I am following some on-line tutorial of it,and I just have a simple question now: suppose we have a original xml file,do we need to write a XSLT Stylesheet to go with it,or do we just simply pass the xml file into some software like Stylus Studio(Saxon Engine),then it will do all these things automatically for us? Sorry for the mis clarification.I need to convert this .svg file to a pdf,I am just now at the beginning of the development,so really confused about the first step.Also,I would like to know,if my initial input is a .svg file,do I have to explicitly

How to use Saxon XPath processor w/o coding in Java

こ雲淡風輕ζ 提交于 2019-12-01 06:47:34
问题 I guess I could make some XSL stylesheet, then use it as a template with parameter option to evaluate XPath expression with Saxon XSLT processor on command line, like: <xsl:template match="/"> <xsl:copy-of select="saxon:evaluate($xpath-param)"/> </xsl:template> Also other possibility is to use their Java API: http://www.saxonica.com/documentation/xpath-api/intro.xml but I don't know Java Is there any way to make Saxon evaluate XPath expression from command line? Shell script would be

Catch output stream of xsl result-document

老子叫甜甜 提交于 2019-12-01 06:32:48
I need a way to interfere in writting xsl result documents to avoid writting them to file system. Right now my template is writting to a temporary directory, and then i zip that directory. I want to do that whitout writting to file system. I am using saxon procesor. A solution that is using just standard java libraries is perfered. Any suggestion is appreciated. EDIT: I found this class for .net saxon api http://www.saxonica.com/documentation/dotnetdoc/Saxon/Api/IResultDocumentHandler.html I need something equivalent for java. You need to implement interface net.sf.saxon.OutputURIResolver http

a beginner question on XSLT

倾然丶 夕夏残阳落幕 提交于 2019-12-01 05:49:09
问题 I just started learning XSLT,now I am following some on-line tutorial of it,and I just have a simple question now: suppose we have a original xml file,do we need to write a XSLT Stylesheet to go with it,or do we just simply pass the xml file into some software like Stylus Studio(Saxon Engine),then it will do all these things automatically for us? Sorry for the mis clarification.I need to convert this .svg file to a pdf,I am just now at the beginning of the development,so really confused about

Catch output stream of xsl result-document

僤鯓⒐⒋嵵緔 提交于 2019-12-01 04:11:20
问题 I need a way to interfere in writting xsl result documents to avoid writting them to file system. Right now my template is writting to a temporary directory, and then i zip that directory. I want to do that whitout writting to file system. I am using saxon procesor. A solution that is using just standard java libraries is perfered. Any suggestion is appreciated. EDIT: I found this class for .net saxon api http://www.saxonica.com/documentation/dotnetdoc/Saxon/Api/IResultDocumentHandler.html I