xslt

Iterate through XML nodes that have xmlns attribute declared in a XSL.

I am working on creating an XSL to format some incoming XML from an API I am integrating. The xml I receive looks like: <items> <item xmlns="http://www.tempuri.org/Item.xsd"&gt; <key>value</key> </item> <item> <key>value</key> </item> <item xmlns="http://www.tempuri.org/Item.xsd"&gt; <key>value</key> </item> </i...

xslt sort by two columns, where one is only partial

Hi I have many nodes I wish to sort. - They all have a create date. - Some have an edit date to. (update) Since no ansers I will add an example of en xml document to search <page> <createdate>2010-01-05</createdate> <editdate>2010-01-07</editdate> </page> <page> <createdate>2010-01-06</createdate> <editdate></editdate> (do not ...

How to solve XML to XML problem using Exslt - set:distinct

This extends from http://stackoverflow.com/questions/2133459/xml-to-xml-using-xsl-problem I managed to import exslt and modified my codes according to the solution (thanks to Kyle Butt) given as follows: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:func="http://exslt....

combine two xml files into one

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; <xsl:param name="pXml1" select="''" /> <xsl:param name="pXml2" select="''" /> <xsl:param name="pRoot" select="'root'" /> <xsl:template match="/"> <xsl:variable name="vXml1" select="document($pXml1)" /> <xsl:variable name="vXml2" select="do...

Understanding `apply-templates` matching

Am I correct in thinking that an apply-templates declaration should match all templates which could possibly be applied for a selection? For example, given the following xml fragment: <doc> <foo bar="1" baz="2">boz</foo> </doc> and the following stylesheet: <xsl:template match="/"> <xsl:apply-templates select="foo" mode="xyz" />...

BizTalk Map Incorrectly Parsing Input XML

I've got a situation where my BizTalk map is not extracting data from input XML correctly. The input schema looks like this: Sequence A B All 3 of those nodes on the XSD have min 0, max unbounded. So here's a sample input file fragment: <A>1</A> <B>hi</B> <A>2</A> <B>there</B> Now my map takes this data and calls stored pr...

xsl:param and multiple filters

Hi, I'm trying to pass parameters (through c#) to the following XSLT to build a query with multiple filters but it is not working. What am I doing wrong and what is the correct way to do this? (The filter works with hard-coded values and the parameter values are getting through to the XSLT) Thanks! <?xml version="1.0" encoding="utf-8"...

exslt.org extensions

I am trying to use an exslt extension in one of my transformations. I got an example off this site about how to concatenate xml files into one. I have implemented the namespace and the element prefix correctly, but every time I try and run it from my command line I recieve the following error... Cannot find a matching 1-argument functi...

Using XSLT to compare two nodes and emit XML containing attribute indicating whether value was updated, added, or deleted

Been programming front-end languages for a long time and I rarely encounter XSLT on a project. Well, here it is... We currently have some functions in our XSLT file that are comparing nodes and emitting XML that contains something like previousValue="Old value". This feature helps our users understand what changed when viewing the for...

Efficient code for replacing a text node with some other text using XSLT?

I have an XML where a text node with value "null tag" appears (randomly) at the different places in the file. My question is how to replace the text with some other text, where the element (and parent node) name is unknown. I have already created an XSLT file which looks a bit bulky and I am not sure about its efficiency in transformatio...

Selecting an abstract of n words including HTML tags with XSLT

I want to select an abstract, along with HTML format elements using XSLT. Here is an example the XML: <PUBLDES>The <IT>European Journal of Cancer (including EJC Supplements),</IT> is an international comprehensive oncology journal that publishes original research, editorial comments, review articles and news on experimental oncology, ...

How to add xml-stylesheet tags to an XML file using C# ?

Hello, I need to add the following code to the beginning of an XML file, while creating it: <?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/xsl" href="colors.xslt"?> I'm sure there is a method for this, but I haven't found it yet. I'm using C#. Thank you ...

XSL - loop through sub nodes in XML

I whant to loop through a XML file thats look like this: <node> <cd name="td1"> <data value="cd1-0" /> <cd name="td2"> <data value="cd1-1" /> </cd> <cd name="td3"> <data value="cd1-2" /> </cd> </cd> <cd name="td4"> <data value="cd2-0" /> </cd> </node> This is the result that i what is this. ...

Group and filter XML data with XSL

I have the following XML code: <root> <options> <companies> <company url="http://www.brown.com"&gt;Brown LLC</company> <company url="http://www.yellow.com"&gt;Yellow LLC</company> <company url="http://www.black.com"&gt;Black LLC</company> <company url="http://www.bourdeaux.com"...

how to apply group by on xslt elements

Hello All, I need to group the value based on some attribute and populate it. below mentioned is i/p xml and if you see there are 4 rows for Users and for id 2,4 Division is same i.e. HR while generating actual o/p I need to group by Division ... Any help ??? I/P XML <Users> <User id="2" name="ABC" Division="HR"/> <User id="3" n...

What is the difference between the various xsl files included with CheckStyle?

The CheckStyle distribution contains several example XSL files for formatting reports. With CheckStyle 5.0, they are: checkstyle-author.xsl checkstyle-csv.xsl checkstyle-frames-errors.xsl checkstyle-frames.xsl checkstyle-noframes-sorted.xsl checkstyle-noframes.xsl checkstyle-simple.xsl checkstyle-text.xsl Some of the names are more ...

Making JAXB generate an XML processing instruction

I am generating XML dynamically using JAXB. Now, I want to convert it to HTML using XSL. How can i include <?xml-stylesheet type="text/xsl" href=""> in the dynamically generated XML? ...

selecting current element name in XSLT

I need to output the element name which is being returned after applying the xpath expression for example <xsl:for-each select="//element"> <xsl:value-of select="**{elementname}**"></xsl:value-of> <xsl:text>:</xsl:text> <xsl:value-of select="current()"/> <xsl:value-of /> </xsl:for-each> How can i replace {elem...

Create a list/array in XSLT

I have the following scenario. I have a list of countries (EG, KSA, UAE, AG) I need to check an XML input if it is contained in this list or not: <xsl:variable name="$country" select="Request/country" > <!-- now I need to declare the list of countries here --> <xsl:choose> <!-- need to check if this list contains the country --> <x...

Porting JavaSript application into the Silverilight (XML/XSLT/HTML vs. XAML)

We are in the process of porting existing JS application to the Silverlight. You can imagine application as a some kind of document management application: 1.) Documents are stored as XML documents. 2.) Documents can be of different types. Document types can be added without source code modification (everything is in the DB or FS). - Eac...