xslt

XSLT processing with Qt

Hi, I like to display some (X)HTML content in a Qt application using QtWebKit. The content should be generated from XML documents via XSLT. As I am new to Qt, my questions are as follows: 1) Can QtWebKit display XML documents with the xml-stylesheet element set? 2) Can Qt apply XSLT to an XML document and return the result as a string ...

Sort by date in XSL

I am trying to sort by date for XML output. Here is my XSL: <?xml version="1.0" encoding="UTF-8"?> <!-- Example by Phil 'iwonder' Guerra --> <!-- Edited by Lee Sykes DNN Creative Magazine http://www.dnncreative.com --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; <xsl:output method="html" inden...

Javascript in XSL that is loaded by Javascript

Is there anyway to have javascript run when a XSL sheet has been applied to an XML file by Javascript? I am using a JQuery plugin to apply the sheet to the xml but the javascript that is located inside of the XSL file will not run. I put the Javascript at the bottom of the file and it still does not run.. I can't seem to get an alert t...

conditional selection of decimal-format in xslt

Hi all, I'm trying to modify the decimal-format of a stylesheet based on certain information of an XML. More exaclty, I've a XML like this <?xml version="1.0" encoding="ISO-8859-1"?> <REPORT> <LANGUAGE>2</LANGUAGE> <MYVALUE>123456.78</MYVALUE> </REPORT> I'm trying to define the decimal format as european if the language is 2,...

Removing white space inside quotes in XSLT

I'm trying to format a table from XML. Lets say I have this line in the XML <country>Dominican Republic</country> I would like to get my table to look like this <td class="country DominicanRepublic">Dominican Republic</td> I've tried this: <td class="country {country}"><xsl:value-of select="country"/></td> then this: <xsl:eleme...

Is dynamic evaluation of XPath variable string possible using .NET 2.0 XSLT implementation?

I'm trying to evaluate an XPath varable I'm building dynamically based on the position of the node. I can create the XPath string in a variable but when I select the value of this just get the string and not the node set I need. I use the following to create the XPath query. <xsl:variable name="xpathstring" select="no...

xpath for-each multiple conditions

What is wrong with the following line? <xsl:for-each select="//Node1/Node2/Node3 [.!='Primary' or .!='Secondary' ]"> Trying to select all elements where Node3 is not Primary o Secondary. Thanks. ...

xslt (table) by matching the attribute value.

I need to generate an xsl table for the xml below, for attributes fname and lname. I guess I have done something wrong in xpath. Could someone help me out by writing an xsl table for the xml below.. <sparql> <head> <variable name="s"/> <variable name="fname"/> <variable name="lname"/> </head> <results...

Saxon XSLT-Transformation: How to change serialization of an empty tag from <x/> to <x></x>?

Hello folks! I do some XSLT-Transformation using Saxon HE 9.2 with the output later being unmarshalled by Castor 1.3.1. The whole thing runs with Java at the JDK 6. My XSLT-Transformation looks like this: <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns="http://my/own/custom/namespace/for/...

xsl with javascript

I've a file with xml data. And I want to generate a report out of it. I tried to integrate xsl with java script, but can I get a handle of individual data elements in xsl and pass it on to a java script function. Lets say <value>true</value> is in the xml and I want to pass it on to a javascript function while doing something like this...

XSL Template - reducing replication

Hey Sorry about the extremely vague question title (any suggestions for improvements welcome) I have an XSL document that, currently, has lots of replication that I want to reduce. Here is the following XML snippet I am working with <Unit Status="alive"> I am currently using the following XSL to show images based on the status of ...

Java: XML/XSL Transformer how to get more information on an error ?

Hi i'm getting exception on Transformer transformer = tFactory.newTransformer(StreamXSL); but the error below is not explicit i cannot understand why "Could not compile stylesheet" ? Tks static String getHtml(String xml) { Element elementObj = getElementObject(xml); String xslName = getValueOfElement(elementObj, xml, "XSL_TO_R...

Using xsl:variable in a xsl:foreach select statment

I'm trying to iterate through an xml document using xsl:foreach but I need the select=" " to be dynamic so I'm using a variable as the source. Here's what I've tried: ... <xsl:template name="SetDataPath"> <xsl:param name="Type" /> <xsl:variable name="Path_1">/Rating/Path1/*</xsl:variable> <xsl:variable name="Path_2">/Rating/Path...

XSLT pass node into CDATA JS

I have the following xml <AAA> <BBB>Total</BBB> </AAA> Transforming it with the following xslt using the xsl:copy-of tag, because I want to use the xml to create a xml doc in js. <xsl:template match="/"> <![CDATA[ function myFunc() { xmlStr = ']]><xsl:copy-of select="/"/><![CDATA['; } ]]> </xsl:template> The out...

How do I combine or merge grouped nodes?

Using the XSL: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" version="2.0"> <xsl:output method="xml"/> <xsl:template match="/"> <records> <record> ...

XSLT: How to reverse output without sorting

Hi, I have a list of items: <item>a</item> <item>x</item> <item>c</item> <item>z</item> and I want as output z c x a I have no order information in the file and I just want to reverse the lines. The last line in the source file should be first line in the output. How can I solve this problem with XSLT without sorting by number etc...

XSL for-each and value-of

Given the xml: <element>text</element> ... <element>text</element> And xsl: <xsl:for-each select="element"> ... </xsl:for-each> What do I need to put inside the for-each loop to access the text? There doesn't seem to be a corresponding xsl:value-of because select="", select="/", and select="element" are all wrong. ...

Generating report from an xml file

I want to generate a report from an xml, preferably html. The html here should be dynamic to allow limiting the view based on some user entered values, preferably selecting from a drop down of categories, which inturn is populated from the xml. I also want to have links in the report to more info which is stored in another xml file. I s...

XSLT: How to remove the self-closed element

I have a large xml file which contents a lot of self-closed tags. How could remove all them by using XSLT. eg. <?xml version="1.0" encoding="utf-8" ?> <Persons> <Person> <Name>user1</Name> <Tel /> <Mobile>123</Mobile> </Person> <Person> <Name>user2</Name> <Tel>456</Tel> <Mobile /> </Person> <Person> ...

XSLT: Whole table columns count.

Good afternoon, gentlemen. Please help us solve the problem, I do not have enough brains to solve it by myself. There is a table, you must define "simple" it or "complicated". Table "simple" if each row contain only two column, otherwise it is "complicated" table. How to do this means xslt. ...