Tag Archives: xslt

xslt 1 and sum function

Questions: I create an invoice management system using xml and PHP but the latest PHP version does not support XSLT 2.0 – therefore I have to look for an sum() alternative. How can I transform the valid xslt 2 function “sum(unitprice * quantity)” to xslt 1.0 ? The XML stuff is based on John’s Examples… Read More »

Generate EXCEL from XML using XSLT

Questions: I have the below XML in place. Want to generate a EXCEL out of it by using XSLT. But I’m new to this and have no idea on how to generate a XLS from XML and how do use it for XSLT. XML — <?xml version=”1.0″ encoding=”UTF-8″ standalone=”yes”?> <mig:menu-compare xmlns:mig=”http://www.com/migration/” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://www..com/migration”> <mig:menu-info> <mig:menu… Read More »

XSLT processing with Java? [closed]

Questions: How to transform XML with XSLT processor in Java? Answers: Here is sample for using java api for transformer, as @Raedwald said: import javax.xml.transform.*; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import java.io.File; import java.io.IOException; import java.net.URISyntaxException; public class TestMain { public static void main(String[] args) throws IOException, URISyntaxException, TransformerException { TransformerFactory factory = TransformerFactory.newInstance(); Source xslt… Read More »

Fatal error: Class 'XSLTProcessor' not found

Questions: I’m using XAMPP Server 1.7.7 While opening the php file, i receive the error Fatal error: Class ‘XSLTProcessor’ not found Answers: Install the XSL extension to get that class. This might be as easy as uncommenting (remove the starting ‘;’) on the line that reads extension=php_xsl.dll in php.ini on Windows, or apt-get install php5-xsl… Read More »

Format a date in XML via XSLT

Questions: When I use the XML serializer to serialize a DateTime, it is written in the following format: <Date>2007-11-14T12:01:00</Date> When passing this through an XSLT stylesheet to output HTML, how can I format this? In most cases I just need the date, and when I need the time I of course don’t want the “funny… Read More »

check if xml file exists with XSLT 2.0, saxon9HE

Questions: I’d like to check, whether a file exists, with xslt 2.0. However, it’s not working. I’ve tried this: <xsl:choose> <xsl:when test=”doc(iri-to-uri(concat($currFolder, ‘/’, $currSubFolder, ‘/’, @href)))”> (The path is correct) however, this results in an error, when the file isnt there. and this: <xsl:choose> <xsl:when test=”doc-available(iri-to-uri(concat($currFolder, ‘/’, $currSubFolder, ‘/’, @href)))”> doesn’t work, it tells me… Read More »

Transform XML with XSLT in PHP

Questions: I’m trying to combine two xml-files and with a XSLT-file transform them into a XHTML-page. I have not done this before and can´t figure out how to do it. This is what I have so far, with just one xml-file: <?php $xsl = new DOMDocument(); $xsl->load(“file.xsl”); $inputdom = new DomDocument(); $inputdom->load(“file.xml”); $proc = new… Read More »

How to apply XSLT 2.0 transformations in .net?

Questions: I understand that the .net XsltCompiledTransformation class supports only XSLT 1.0 transformations and Microsoft has no plans to even introduce support for XSLT 2.0. I’ve looked at software for performing XSLT 2.0 transformations. The problem is that I need an alternative to Microsoft’s XsltCompiledTransformation class that will apply transformations on the fly in my… Read More »

Best way to create PDF from XML XSLT in C#

Questions: I have a requirement to crate a PDF of XML Records. I think there is no way to directly create pdf from xml but using XSLT or XSL FO i believe it can be done. I have been reading lots of articles searching for the good way to do that using C#. –> What’s… Read More »