xslt

XSLT sort subelement followup

Similar to the previous subelement sort, but I have a few extra layers of nodes. I can't figure out a simple extension to the previous answer that works. http://stackoverflow.com/questions/572854/how-to-sort-a-subelement-of-xml-with-xslt The simplified input example: <Iteration> <Iteration_query-ID>NODE_10008</Iteration_query-ID> ...

XSLT: How to represent OR in a "match" attribute?

I want to perform a series of operations on elements that matched the name "A" or "B". I'm thinking of something like this below, but it doesn't work. <xsl:template match= " 'A' or 'B'" > <!-- whatever I want to do here --> </xsl:template> Couldn't find the appropriate XSLT language reference for it. Please help! Thanks!! ...

Is it possible to transform javabeans with XSLT and JXPath?

Suppose I have a vanilla javabean: class Person { String firstName; String lastName; ... } Now suppose I want to transform this into another javabean: class Human { String name; ... } I'm currently using JXPath to help me transform one to the other: JXPathContext personContext = JXPathContext.newContext(person); JXPathCo...

MSXML: How does one programmatically get the error text for failed transforms?

XMLNotepad provides the following text (for example) when a transform fails: Error Transforming XML The variable or parameter 'saturated-background-color' was duplicated with the same import precedence. How would I go about getting this error text programmatically? My code looks like this: CComPtr<IXSLTemplate> tmpl; HR...

Adding a namespace to a nested element

I have some XML similar to this: <envelope xmlns="http://test"&gt; <header> <msgId /> </header> <body> <element1 /> </body> </envelope> I want to add a namespace to the <element1> node. Can anyone help me how to do this with XSLT? ...

How to generate a treeview in html from flexible xml just in client side

Hi, Could anyone please give me an example in this? I have found many but they didn't match my requirement. The treeview must have expand and collapse, the xml is flexible, which means I should test if a node is exist, and there are many may appear many times and with different contents. Also, I need it works just in client side, nothi...

How to extend this XSLT to include XML fields dynamically?

We need to parse an XML file with XSLT into a CVS file. The code below works but only if the fields in the XML are always constant. The fields in the our XML file will always vary. How can I change my XSLT file so that it dynamically includes in the CSV file all the fields from the XML file? XML: <?xml version="1.0" encoding="iso-8859...

How do I convert an ISO 8601 duration to seconds using XSLT 1.0

It seems like this is easy to do in XSLT 2.0 but Microsoft in its infinite wisdom doesn't support XSLT 2.0 in Visual Studio 2005. ...

XSLT: How to get file names from a certain directory?

Is there a function in XSLT that can takes in a directory path and gives back all the files in it?? I have a xml file now reads like this <filelist> <file>fileA.xml</file> <file>fileB.xml</file> </filelist> Now, there's directory called dir, has files fileX.xml, fileY.xml and a bunch of other xml files in it. I want to add th...

build tree from flat list in XML using xslt

hi all, i use a minimalist MVC framework, where the PHP controler hands the DOM model to the XSLT view (c.f. okapi). in order to build a navigation tree, i used nested sets in MYSQL. this way, i end up with a model XML that looks as follows: <tree> <node> <name>root</name> <depth>0</depth> </node> <node> ...

Is there a way to ignore namespaces during an XSL transformation?

Namespace checking is disabled on the server that handles XSL transformations (because the guy who wrote the XSL didn't understand namespaces). I have to make changes to the XSL but I can't test it because there aren't any namespaces defined ie. Instead of <xsl:template match="ns:element[position()=1]">... it has <xsl:template m...

Condition <xsl:output> in XSLT 1.0?

I have a XSLT 1.0 (2.0 is not an option) stylesheet which produces XHTML. It can, depending on a parameter, produces a full XHTML validable document or just a <div>...</div> snippet, intented for inclusion in a Web page. My problem is to produce different XML declarations in these two cases. For the standalone page, I need: <xsl:output...

Why aren't my XSLT variables substituting their values?

I am trying to use XSLT variables and not having much success, hopefully I'm just doing something dumb. I have the following code snippet: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xalan="http://xml.apache.org/xslt" version="1.0"> <xsl:template match="/"> <xsl:variable name="config" select=...

Display dynamic content in a frame controlled by the tree created from XML in another frame

I have an XML file: <root> <foo> <!--Content Here--> </foo> </root> Now I want generate an HTML file from it. The HTML has two vertical frames. The left one displays the treeview of the XML file. And I want the right one display content of the tree view: when I click on the "foo" node, the content will be displayed on the righ...

Inline output document selection using result document in XSLT 2.0

Greetings, I'm looking for a method to do in-line result (output) document selecting in XSLT. I know of the method where one creates an xsl:result-document node to have one transformation apply to multiple documents. Usually this method uses several passes, such as: <xsl:template match="/"> <xsl:apply-templates select="*"/> <xs...

XSLT: Walking a tree-like structure

I have an xml document, that has a list of categories: <categories> <category id="1" parent="0">Configurations</category> <category id="11" parent="13">LCD Monitor</category> <category id="12" parent="13">CRT Monitor</category> <category id="13" parent="1"">Monitors</category> <category id="123" parent="122">Printer<...

Enumerated Values based on distinct ones XSLT 2.0

I have a long list of values in XML with named identifiers. I need to make separate output files for each of the distinct identifiers grouped together and uniquely named. So, for example, let's say I have: <List> <Item group="::this_long_and_complicated_group_name_that_cannot_be_a_filename::"> Hello World! </Item> <Item ...

How to use php sessions in xslt?

How do I use php sessions in XSLT for example for making a shopping cart for a webshop? A user can browse the site and click "Add to cart" on several items. Each item should then be stored in a session variable. The user can at all time view the items selected by clicking "View cart". ...

How to convert ticks into a readable datetime with XSLT?

I have an XML with timestamps like this: <node stamp="1236888746689" /> And I would like to display them in the result HTML as date with time. Is there a way to do it with XSLT (any Version)? EDIT: I am using XSLT2.0 with Saxon9. The base date is 1970-01-01 0:00. ...

Are there any XSL Lint tools?

I'm looking for an XSL lint tool which is actively maintained. The only one I can find is this one, but the last update was in 2000 (9 years old!). Any help would be great! ...