xslt

How to remove duplicates based on level in hierarchy?

Hello, I have the following XML structure: <node name="A"> <node name="B"> <node name="C"/> <node name="D"/> <node name="E"/> </node> <node name="D"/> <node name="E"/> </node> I need to get all the leaf nodes. I use //node[not(node)] to get those. Now I need to remove duplicates by leaving elements that are deeper...

wrap sibling nodes based on on attribute

Using XSLT, how can I wrap siblings that share the same value for an attribute. Lets say I need to wrap a one or more <amendment/> with the <chapter/> they belong too. From this: <section> <heading>some heading text</heading> <amendment num='1' chapter='1'> <foo/> </amendment> <amendment num='2' chap...

select a node with an xmlns?

I am trying to select all of the links in a xhtml document in xsl. Some of the anchor tags have the namespace declaration xmlns="http://www.w3.org/1999/xhtml" in them. These are not selected. e.g. with this xml doc: <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="xsl.xsl"?> <root> <item> this iz sum text and it haz sum ...

Browser behaviour with XSL - Firefox different from IE / Chrome

I have the following simple XSL style sheet: <?xml version="1.0" encoding="windows-1252"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0"> <xsl:output encoding="utf-8" method="html" /> <xsl:template match="/"> <xsl:text disable-output-escaping="yes"> &lt...

How to insert text with XSLT v1.0 instead of using an XSLT v2.0 regex?

I have an xml file which describes (among other things) elements with attribute values that describe fully qualified java class names. I am trying to write an XSLT transformation to modify the class names described in this file, such that (for example) ocurrances of com.example.MyClass will become com.example.MockMyClass. Here's that ex...

Move separator elements upwards in xml hierarchy

I have an xml document with separators deep down in the hierarchy. <A> <B> <C id='1'/> <separator/> <C id='2'/> </B> <B> <C id='3'/> <separator/> </B> <B> <C id='4'/> </B> </A> I want to move the separators upwards, keeping elements in order. So the desired output is <A> <B> <C id='1'/> </B...

How do I get an XML node with xpath in a loop, based on an attribute with the same name as the attribute in the tree I'm searching?

I cant really formulate that better, so I'll go with an example instead: XML: <root> <foo> <bar id="1">sdf</bar> <bar id="2">sdooo</bar </foo> <feng> <heppa id="4">hihi</heppa> <heppa id="2">sseeapeea</heppa> <heppa id="1">....</heppa> </feng> </root> XSLT: <xsl:for-each select="/root/foo/bar"> <p> ...

XSL matching strings trouble

Hi all, I've been having the issue from here: http://stackoverflow.com/questions/3840502/sharepoint-issue-selective-behavior and I think I've narrowed the problem down to this XSL code: <xsl:if test="contains(translate(string(@Author), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'ab...

Trouble converting XML document to URL

EDIT: The Example now contains all tags that are in my main document Hello everyone! I just had a quick question about XSLT. I have a large xml file with many <DIMENSION_Id> nodes nested inside each other. In each <DIMENSION_Id> node there are two SYN tags: <SYN>String</SYN><SYN>Integer</SYN> What I am trying to do is take the furthest...

Modify XML structure to create a Nested Tree XML structure using XSD or XSLT

Hello, please I was wondering if someone can please help as its quite urgent. I need to convert the structue of an xml file to another xml structure so that I can bind it to a asp.net treeview control (i'm a c# developer). I noticed the asp.net treeview control accepts a transform file or xpath expression and am wondering if some one kno...

API choice, should I return XPathNavigator or XmlDocument

I'm building a new API for an existing service. The methods in it will be called from with in XSLT as .net extensions however I can see me needing to use the same API to do some .net XML juggling too. I've been toying which how best to write this all night. For it to be XSLT friendly I'll be returning XML in a XPathNavigator object so t...

Back Button in IE shows plain xml instead of loading xsl stylesheet

IE has weired behaviour when pressing back button. When trying to open a webpage server seds a 302 responce that redirects client to Login xml page with xsl stylesheet. After user successfully logged in some page is loaded. However, when user presses "back button" and reaches Login page, IE shows only xml values as plain text instead of ...

Upgrade PHP XSLT to 2.0

Is it possible/easy to upgrade PHP's to use XSLT 2.0? Current set up: xsl XSL enabled libxslt Version 1.1.24 libxslt compiled against libxml Version 2.6.32 EXSLT enabled libexslt Version 1.1.24 ...

Problem with php's XSLTProcessor

I'm trying to use the XSLTProcessor class in php to generate xhtml from a .dita file based on the DITA Open Toolkit's xslt files. The XSLTProcessor is working with simple xml and xslt files (e.g. with the samples on wikipedia), but it fails with the Open Toolkit's xsls. The intresting part is that everything works well, if I use xsltpr...

Umbraco and EXSLT sets do not work

Hi, I'm creating some xslt's using Umbraco 4.5.2 and I want to add de set:distinct function from EXSLT.org (http://www.exslt.org/set/functions/distinct/index.html) however, when I reference the set:distinct I get the error: System.Xml.Xsl.XslTransformException: Cannot find a script or an extension object associated with namespa...

Convert XSL working draft to current version

Hi, I'm converting an old website which uses clientside XSLT based on an old working draft: <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"&gt; It looks like IE is the only browser who can manage to transform the HTML client side. When transforming is done serverside with .net code, it will throw an error: System.Xml.Xsl.X...

XSLT 1.0 - Create node set and pass as a parameter

Using XSLT 1.0, I'm trying to essentially create a small node set and then pass it as a parameter to a template, something like the following: <xsl:call-template name="widget"> <xsl:with-param name="flags"> <items> <item>widget.recent-posts.trim-length=100</item> <item>widget.recent-posts.how-many=3</item> <item>...

xml not showing in Browser

Below is the input xml : <?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/xsl" href="value-of.xsl"?> <MemeberDetails> <Employee> <Name>Madhu</Name> <Sex>Male</Sex> <DOB>2/10/1982</DOB> <Address>JP Nagar ,Bangalore</Address> <MemberId>094631</MemberId> <Designatio...

set size of image with xsl

I have a XML that contains img tag <xml> <img src="/path/to/file.jpg" orginalwidth="150" /> </xml> I want to have: <img src="/paht/to/file.jpg" size=SIZE /> Where SIZE is minimum of orginalsize and 100px ...

Xslt for-each and key match

I have two xml data sources like this: <orders> <order> <ordernumber>123</ordernumber> <subtotal>20</subtotal> <total>23.5</total> </order> <order> <ordernumber>234</ordernumber> <subtotal>19</subtotal> <total>26.5</total> </order> </orders> <orderitems> <item> <ordernumber>123</ordernumber> <productname>test1</pr...