xslt

Group a non nested XML structure to a XML tree structure

Hi all, I need to transform following repeating pattern <root> <bar>bar 1</bar> <baz>baz 1</baz> <qux>qux 1</qux> <bar>bar 2</bar> <baz>baz 2</baz> <qux>qux 2</qux> </root> Into this; <root> <foo> <bar>bar 1</bar> <baz>baz 1</baz> <qux>qux 1</qux> </foo> <foo> <bar>...

Using C# to do xslt transform ignoring xsl:output

I am doing an xslt transform inside my c# program. When I run the xslt on its own it outputs just fine, but when I run it from within my c# program it always leaves off the: <?xml version="1.0" encoding="UTF-8"?> At the top of the resulting xml document. My XSLT file looks like: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet ...

Copying an XSLT variable

Hello Stack Overflow, I'm working on an Umbraco XSL Stylesheet and I am pretty stuck. Basically, I have a parameter that I test and use it's value if it's present, otherwise I use the default parameter $currentPage. Here are the parameters <xsl:param name="source" select="/macro/sourceId" /> <xsl:param name="currentPage" /> Here's ...

XSLT does not work when I include xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"

My Google sitemap renders well through XSLT fine without the xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" in the < urlset > element, however when included, my foreach statement doesn't work and nothing renders in the template. My code's below. Thanks for your help. XML <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"&...

How do I select all comment nodes in an XML file?

Simple question. I have an XML file with a few dozens of comment blocks. This is being transformed by a stylesheet to generate an HTML page. However, the comments are ignored with this. But at the bottom of the generated HTML I would like to have a list of all comments within the XML file. Is that even possible, without the use of anythi...

How to integrate Simply Hired XML API with C# code(ASP.NET MVC )

HI, Simply hired provides APIs for accessing job info programmatically. please have a look at the following URL. Simply Hired API call When i make a request with this URL. I get some thing like XML. But this doesnt begin with a XML tag . The SImply Hired API provider have also given the DTD to validate against. E.g Response from s...

Convert XML tree into flat list of nodes using XSL

How can I convert this XML <albums> <album title="New Zealand"> <album title="Auckland"> <image title="Mt Eden railroad station"/> <image title="Morgan St"/> </album> </album> <album title="Russia"> <image title="Capital of Siberia"/> </album> </albums> into that <div cl...

Detect if an XML file contains a specific namespace

Again a simple thing. I have a stylesheet that parses XML and XSL files. Basically, it tries to detect if the XML is a stylesheet with: <xsl:if test="count(//xsl:template)!=0"> It does indeed detect stylesheets. It has problems with XML files, though, which generate an "Undefined namespace prefix - 'xsl'" error. (In XmlSpy. Similar er...

Building nested hierarchy of ids using XSLT

Continuing my previous question. XML <albums> <album title="new_zealand"> <album title="auckland"> <image title="mt_eden_railroad_station"/> </album> </album> </albums> Expected output <div> <a href="#new_zealand">new_zealand</a> </div> <div id="new_zealand"> <a href="#new_zealand/aucklan...

XSL output method text including whitespaces in xsl

Hi, I am creating some xsl to transform my xml into text (which will be csv eventually). I am using VS2008. When I use the editor to create the xsl, the transformed output is indented as per my xsl. However, if I edit the xsl and remove the formatted whitespaces it outputs correctly - but doing it like this is a nightmare to work wit...

Detecting incoming XML "CR" character, then converting to <br/>

I am using XSLT inside of ASP, it's serviced by msxml6. Incoming XML loaded to the object has "carriage returns" which I think may be ASCII 10. I would like to transform those to <br/> in the output. I am trying to detect &#10; in the incoming XML, but can't seem to find that. I've tried Javascript (JScript inside of ASP), to no avai...

Is the Android Browser capable of performing an xsl transform?

I have an xml file I wish to transform using an xsl-document, but I can't seem to make it work on even the latest available Android versions. I tried adding an tag to the xml, but that didn't work in either the native browser or in Dolphin Browser. Is there a way to script the transform to happen client-side, or is the only option to ...

Alphanumeric sort on mixed string value

Given XML snippet of: <forms> <FORM lob="BO" form_name="AI OM 10"/> <FORM lob="BO" form_name="CL BP 03 01"/> <FORM lob="BO" form_name="AI OM 107"/> <FORM lob="BO" form_name="CL BP 00 02"/> <FORM lob="BO" form_name="123 DDE"/> <FORM lob="BO" form_name="CL BP 00 02"/> <FORM lob="BO" form_name="AI OM 98"/> </forms> I need to sort the FOR...

XSL XML banner ok in IE/Firefox not showing in Chrome

I have a following code: <script type="text/javascript"> if (window.ActiveXObject) { var xml; xml=new ActiveXObject("Microsoft.XMLDOM"); xml.async=false; xml.load("http://www.mypage.com/some.xml"); var xsl = new ActiveXObject("Microsoft.XMLDOM") xsl.async = false xsl.load("http://www.mypage.com/some.xsl") document.write(xml.transfor...

XSLT - How to get IE consitional statements working in an XSTL

I've noticed IE conditional statements don't work in the transformed XML document. How do I get IE 6 and above to process them. Code as follows '<!--[if IE 6]><style type="text/css" media="all">@import "/css/ie6.css";</style>' Thanks. ...

XSLT Transformation doubt

I want to write an xslt to transform one xml file to another. The source XML file is like the following <orgs> <organization revenue="10000"> <name>foo</name> </organization> <organization parent="foo"> <name>foo2</name> </organization> <organization parent="foo2"> <name>foo3</name> </organization> </orgs> The output xml should be...

XSLT 2.0 replace function behaves wrong

The XSLT 2.0 template <xsl:template match="/"> <xsl:value-of select="replace('aba', 'a', 'b')" /> </xsl:template> is expected to return 'bbb', which it does correctly when processed using saxonb-xslt on my Ubuntu 10.04 system. But when I issue exactly the same command on my Debian 5.0 system the output is 'abb'. In other words, th...

Restrict output by range in XSLT

I am creating an XSLT and i want to select a particular node, only if one of its child element's value is between a range. The range is to be specified using parameters in the xsl file. The XML file is like <root> <org> <name>foo</name> <chief>100</chief> </org> <org parent="foo"> <name>foo2</name> <chief>106</chief> </org>...

XSLT, finding out if last child node is a text node

Look at the following two examples: <foo>some text <bar/> and maybe some more</foo> and <foo>some text <bar/> and a last <bar/></foo> Mixed text nodes and bar elements within the foo element. Now I am in foo, and want to find out if the last child is a bar. The first example should prove false, as there are text after the bar, but ...

How to get values of all the occurence of same element in XSLT?

Hi, I have an XML File like : <company> <dept> <name> Dept-A</name> <proj> <id> A1 </id> <noOfPeople> 5 </noOfPeople> <proj> <id>A11</id> <noOfPeople> 2 </noOfPeople> </proj> </proj> </dept> <dept> .... </dept> </company> Now: I want to have a list of all the proj...