xslt

Changing a namespace value in an XSL transformation?

I'm not sure if that is possible, as I'm very new to XSLT and stuff, but maybe some of you could help me here? It's a bit tricky and I haven't found anything like it on the internet: The problem is that I have an input xml with namespaces declared and all and I only need to make slight changes to it (adding or deleting attributes, or sh...

Protecting from XSLT injection

I use a xsl tranform to convert a xml file to html in dotNet. I transform the node values in the xml to html tag contents and attributes. I compose the xml by using .Net DOM manipulation, setting the InnerText property of the nodes with the arbitrary and possibly malicious text. Right now, maliciously crafted input strings will make my...

Problem with ampersand in XSLT output

I use XSL to transform a XML document into HTML in .NET. One of the nodes in the XML has a URL that should be output as the href parameter of the a HTML tag of the HTML. When the input URL has an ampersand character (e.g. http://servers/path?par1=val1&par2=val2) the ampersand appears in the output HTML as &. Is there any way ...

In xsl, is there a way to next a normalize-space call inside a sum?

I have an XML file that has a number of nodes, each of which contains a <current-fine> node. I need to sum these values but unfortunately they contain white-space so I end up getting NaN as the total. Is there a way of achieving the following: <xsl:value-of select="sum(normalize-space(node/sub-node/current-fine))"/> Many thanks ...

Retrieving one element and filter by another

Having tried and failed to modify the XSL from here: http://stackoverflow.com/questions/399204/xslt-distinct-elements-and-grouping I'm posting here to ask if anyone could please help. I've basically got the same data structure (mine is actually an RSS feed of products) as in the above post, but I want to list the Description elements un...

Sharepoint XSLT Data View: Get all items that were created in the last 30 days

I know you can create a basic view to do this, but what I really need is a query in the XSLT Data View that will show all the records where @Status = 'Open' and @Created < 30 days ago. I intend on displaying a chart that shows the count of how long tasks have been sitting in the pipe without being worked on. So, what I did was created...

xsltprocessor debuging in Chrome

This code:: xslProcessor = new XSLTProcessor(); xslProcessor.importStylesheet(xsl); result = xslProcessor.transformToFragment(xml, document); works fine in Firefox, but result is null in Google Chrome. xsl and xml are both loaded from the network via XMLHTTPRequest, and show as Documents in the Chrome JS console. How can I get more i...

Using XSLT with codebeside ?

I find XSLT useful for a number of renderings (without too much logic builtin). When XSLT doesn't do the job, creating the functionality as an XSLT extension in .Net is a simple way to get the full power and functionality of the C#. However - I've been unable to work out if XSLT extensions can be done in CodeBeside code ? I've only been...

XSLT equivalent for JSON

Is there an XSLT equivalent for JSON? Something to allow me to do transformations on JSON like XSLT does to XML. ...

How do I apply templates to each selected node in a for-each?

I know I'm missing something here. In the XSLT transformation below, the actual result doesn't match the desired result. Inside the for-each, I want to apply the match="track" template to each selected track element. If I've understood XSLT properly, with the current setup only child nodes of each selected track element are matched agai...

xsl:import using stylesheets

Hi, I'm building a website that uses xsl stylesheets, and I'm building up a small library of useful funtions in a util stylesheet that other sheets import with <xsl:import href="util" /> at the top of every sheet. This doesn't work in Google Chrome, as it doesn't support xsl:import yet. Can someone please write me a stylesheet that ...

Why don't all XSLT templates get executed at once?

Refer to: http://stackoverflow.com/questions/1613454/retrieving-one-element-and-filter-by-another In the above linked posting, I don't understand why the two template blocks don't get executed upon in the incoming XML at the same time. As far I can can see, the XSL risks the second template executing for every Document element whether i...

use XSLT to convert RSS to JSON format

I am using XSLT to convert RSS to JSON format and return the JSON to ajax calls. everything works fine but if some elements in the RSS have some double quotes, like the code below, then when I use JSON parser from http://json.org/json2.js to parse the JSON result, it would failed to parse. I have tried to set disable-output-escaping="fal...

Is there an elegant way to add multiple HTML classes with XSLT?

Let's say I'm transforming a multiple-choice quiz from an arbitrary XML format to HTML. Each choice will be represented as an HTML <li> tag in the result document. For each choice, I want to add an HTML class of correct to the <li> if that choice was the correct answer. Additionally, if that choice was the one selected by the user, I wan...

xsl:template match for xml with prefixes

I have this xml file <?xml version="1.0" encoding="UTF-8"?> <bo:C837ClaimParent xsi:type="bo:C837ClaimParent" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bo="http://somelongpathHere/process/bo"&gt; <claimAux> ... </claimAux> <enterpriseClaim> ... <patientAccountNumber>data to capture here</patientAccountNumbe...

converting XML with XSLT

I am have trouble converting my xml using XSLT back to xml in the convert format, this is my XML below: <?xml version="1.0" encoding="UTF-8" ?> <DOCUMENTS> <DOCUMENTS_INFO DOCUMENT_COUNT="8" /> <DOCUMENT_GROUP NAME="Invoices" DISPLAY_NAME="INVOICES"> <DOCUMENT> <FIELD> <name>USER</name> <display_name>Deposited by</di...

xsl-fo block-quotes with quote marks

Hi, I am trying to code a something quite simple which is complicated greatly by xsl-fo inline and block level elements. Here is a sample of the XML: <quote-block open="&quot;" close="&quot;"> <quote-para>text...</quote-para> <list> <item>...</item> <item>...</item> </list> <quote-paragraph> <para>...</pa...

XSLT to transform list into table with columns determined dynamically

I need this XML, <list columns="3"> <item>martin</item> <item>donald</item> <item>whistler</item> <item>mother</item> <item>carl</item> <item>liz</item> <item>cosmo</item> </list> to look like this: <table> <tr> <td>martin</td> <td>donald</td> <td>whistler</td> </tr> <tr> <td>mother</td> <td>ca...

parsing multiple lines in 1 line in XSLT

<xml> <data> <Attribute name='forms'> <List> <String>xform</String> <String>yform</String> </List> </Attribute> </data> </xml> How would I set my xslt to get all the values in the List. So I would like to output both values in 1 line seperated by |. For ex. xform|yform ...

XSLT parsing multiple lines

<data> <Attributes> <Attribute name='somethingelse' value='blah'/> <Attribute name='forms'> <List> <String>xform</String> <String>yform</String> </List> </Attribute> </Attributes> </data> I am already parsing the xslt at Attributes level, so I can get the value blah by just doing <xsl:value-of select="Attribute[...