Do XML processors apply <?xml-stylesheet PIs by default? - html

I just wrote an XSL-T file that converts some WSDL files into HTML documentation. Now I'm wondering whether I could use an processing-instruction like the following directly in the WSDL files:
<?xml-stylesheet type="text/xsl" href="./transform.xsl"?>
This works perfectly in any browser I've tested. But I'm curious whether XML processors that actually want to use the WSDL as service description (e.g. SOAP client libraries) would now also convert the document into HTML - which would lead to an unusable WSDL.
Does anyone know whether this is safe or if there's some standard for XML processors that defines how to handle the xml-stylesheet processing instruction?

Related

How to use Parsed XML file in HTML

I have data stored in an XML file, that I want to use to create a website (HTML file). The following is a the format of the xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE dblp SYSTEM "dblp.dtd">
<dblp>
<article mdate="2017-05-28" key="journals/acta/Saxena96">
<author>Sanjeev Saxena</author>
<title>Parallel Integer Sorting and Simulation Amongst CRCW Models.
</title>
<pages>607-619</pages>
<year>1996</year>
<volume>33</volume>
<journal>Acta Inf.</journal>
<number>7</number>
<url>db/journals/acta/acta33.html#Saxena96</url>
<ee>https://doi.org/10.1007/BF03036466</ee>
</article>
I am following a tutorial on using SAX parser with JAVA in order to parse the XML file, where in the end I collect all the authors in a list or so. However I don't understand once I parse the XML file how will I use it in HTML in order to create a page where I display the names of the authors and so on.
PS: My XML file is large (2.3 GB). I am new to web development so I really appreciate your help.
As my experience. I use TemplateLoader from Hapax and use TemplateDataDictionary to set the variable to a dynamic value.
The user can check the link below to get detail.
https://code.google.com/archive/p/hapax2/wikis/Language.wiki#Variableg
Goodluck.

Pull data from reference tables (displayed in XML format) and store it in another XML file

I want to link a reference table, (given to me in XML format via link, from a remote server) into another XML file.
For example
<reference>
<listName>countries</listName>
<itemCount>191</itemCount>
<item type="Country" row="1">
<id>1104</id>
<name>TURKEY</name>
</item>
</reference> <!-- Added by edit -->
The thing is that every single item is in different XML, with different link. So I need to link them all and, (in a way) filter the information in a new XML, which to then import to Word Press.
If not XML to XML, then XML to JSON or CSV is ok. Or if there is an software to help me do this.
Thank you in advance.
The best way is to use some online tool where you can load data from URL i found one editor you can use that or use some similar online tool.
Online Ide for xml to json

Converting folder of XML files to folder of HTML files

I have a folder of several hundred XML files that I would like to convert into a folder of HTML files. I've created an XSLT that works in w3schools.com's XSLT tester, but I'm not sure how to apply that stylesheet across hundreds of XML documents. My XML looks like this (and the only nodes I'm interested in are title, author, and lyrics):
<?xml version='1.0' encoding='utf-8'?>
<song xmlns="http://openlyrics.info/namespace/2009/song" version="0.8" createdIn="OpenLP 2.0.1" modifiedIn="OpenLP 2.0.1" modifiedDate="2012-03-14T02:21:52">
<properties>
<titles>
<title>Amazing Grace</title>
</titles>
<authors>
<author>John Newton</author>
</authors>
</properties>
<lyrics>
<verse name="v1">
<lines>Amazing grace, how sweet the sound<br/>That saved a wretch like me<br/>I once was lost, but now am found<br/>Was blind but now I see</lines>
</verse>
A couple questions about this:
1) Might it be better to use XQuery since I'm only interested in extracting a few lines per XML file?
2) Regardless of XSLT/XQuery, how can I implement a solution that converts a folder of XML files (without manually editing each one to call upon the XSL stylesheet)? I'm running OS X 10.8.4.
Thanks in advance.
Just write your own shell script using the xsltproc command. This is what I used successfully for XSLT batch processing.
Or just open a shell, cd to the folder with the XML files and then enter the following two commands:
mkdir results
xsltproc -o results/ path/to/stylesheet.xslt *.xml
I think XQuery would be more convenient if you had all of your XML in a database, but on the filesystem XSLT may be simpler.
I would just use Saxon-PE, and invoke it from a shell script. You could also use Automator.

XML to XSLT transformation

Dear friends,
We are developing healthcare app which will monitory patient data from remote and display the patient EcG in dynamic graphs is my requirement , basically I am new to XML and XSLT. so what I wanted to know how to transfer the xml EcG data into xslt so that then in linux xsltproc command can transfer xsl file into html file and I can view in browser.
Basic example I know but graphics like lines chat I am confusing how to do ?
please if any one knows let me know thanks in advance. any reference or any links or any example is also ok and great if any one shares.
You don't transfer your XML data to XSLT. With XSLT you can define a stylesheet which defines how to transform XML data (to HTML in your case). So you apply XSLT stylesheet to your XML data.
When you have your XSLT defined, you can use xsltproc like this:
xsltproc stylesheet.xsl myData.xml
You can start with this tutorial to get some idea how it works. (Click "Try it yourself" to see an example of an XML document, XSLT stylesheet and the result)
For graphics like bar chart, pie chart and so on you need java script help which would take your generated XML as input and pass some parameters to javascript which has the ability to produce graphics for you. You can also check FusionCharts on http://www.fusioncharts.com/products/suite/?gclid=CI71hJqsjbUCFVEX6wodPgYAeg

Local XSL reference within XML-File

First a short task description:
There is an XML file which references a xsl stylesheet which is within a *.dll.
The beginning of this XML looks as follows:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl' href='res://name_xsl.dll/frameset.xsl'?>
This xml file can be opened and displayed as an HTML within Internet Explorer and only IE.
(The xsl transform the xml to html)
As you can see it references the win32 system folder, in which the dll file is saved.
Referencing with "res://" does work.
But now I do not want to store my dll within the system folder, but under a different folder lets say %ALLUSERSPROFILE% (environment variable) which e.g. on Windows XP is C:\Documents and Settings\All Users or on Win7 C:\Users\Public (Not sure about that one).
How do I reference to the dll lying in that folder?
Is it possible to do this using environment variables, such that it is system independent?
What solution would you recommend.
(All html, xsl data is saved locally within the dll on the local computer.)
So far I have tried to change the reference line to the following:
<?xml-stylesheet type='text/xsl' href='file:///c:/Documents and Settings/All Users/name_xsl.dll/frameset.xsl'?>
I have also tried the same with the root folder c: and even without absolute path having all files (xml and dll) in the same folder.
All attempts without res:// resulted in the following error message:
The system cannot locate the resource specified.
Error processing resource 'file:///C:/Documents and Settings/All Users/name_xsl.dll/...
or 'file:///C:/name_xsl.dll/frameset.xsl'
Could you help me out? Why it does not find the file?
(filenames are fictive)
This is the solution:
<?xml-stylesheet type='text/xsl' href='res://C:%5CDocuments and Settings%5CAll Users%5Cname_xsl.dll/frameset.xsl'?>
Notes:
You MUST use the res:// protocol to access a resource within a file.
File system backslashes can be encoded as %5C . Possibly forward slashes will work as well.
Example:
I tested this example for the file:// protocol, but it should work the same way as the res: protocol. On my system, I have a text file located at:
C:\Program Files\CodeGear\Delphi for PHP\2.0\privacy.txt
I can access this file, by putting into the nav bar of the Windows File Explorer:
file:///%ProgramFiles%/CodeGear/Delphi for PHP/2.0/privacy.txt
Notice backslashes converted to forward slashes, and no need to escape spaces. This has been tested and it works. The equivalent on the res protocol had not been tested, but it should work the same way, except of course that the res protocol is slightly different in that it also includes a resource index number.
Refer http://msdn.microsoft.com/en-us/library/ie/aa767740(v=vs.85).aspx for syntax.