xslt

XSLT1.0 Rendering sequence of different elements stored in a variable as M x N table

Hello everyone, I have the following XML (it is simplified and most attributes are omitted): <Document> <Transfer Name="" From="" To=""/> <Transfer Name="" From="" To=""/> <OtherElement/> <OtherElement/> <Flight AirLina="" From="" To=""/> <Flight AirLina="" From="" To=""/> <OtherElement/> <Hotel Name="" Duration=""/> ...

XSLT: Regular Expression function does not work?

Ok, this one has been driving me up the wall... I have a xslt function that is supposed to split out the Zip-code part from a Zip+City string depending on the country. I cannot get it to work! This is what I got so far: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exslt="http://exslt.org/functi...

XSLT Transformation of XML File

I've written a simple XML Document that I am trying to transform with an XSLT file, but I get no results when I run the code. Here is my XML document: <?xml version="1.0" encoding="utf-8" ?> <Employee xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="XSLT_MVC.Controllers"> <ID>42</ID> <Name>Russ</Name> </Employee> ...

How can I combine xsl:attribute and xsl:use-attribute-sets to conditionally use an attribute set?

We have an xml node "item" with an attribute "style", which is "Header1". This style can change however. We have an attribute set named Header1 which defines how this should look in a PDF, generated through xsl:fo. This works (the use-attribute-sets is mentioned inline, in the fo:table-cell node): <xsl:template match="item[@type='label...

Using xsl:if to check the value of a node

I want to check if the node <Type> is either "Debit" or "Credit" so that I can transform the information from just credit card information into Debit or Credit transactions. any suggestion???? ...

Pattern Matching with XSLT

I'm trying to match a pattern into a string in XSLT/XPath using the matches function, as follows: <xsl:when test="matches('awesome','awe')"> ... </xsl:when> However, in both Firefox 3.5.9 and IE8, it doesn't show up. IE8 tells me that "'matches' is not a valid XSLT or XPath function." Is this due to XSLT 2.0 not being supported, an...

XQuery vs XSLT for transfroming data

Which one of them do you use in your applications in order to transform XML data to other data types? WHY? ...

XSL template structure for choosing latest event.

I have a list grouped by Region and it currently shows all the items for each city. I want to reduce to only the most recent advisory for each city. I have tried to use an xsl:for-each statement but I am messing up the names/parameters. List is called mlc The list contains the fields: Title City Region Advisory DateCreated TT (calcula...

Select template for execution using a condition including variable on apply-templates

Hi, I have a template that looks like below <xsl:template match="more-info" mode="docuSection"> html </xsl:template> and which is applied with the call <xsl:apply-templates select="." mode="docuSection"/> so the template is applied when the current node has more-info element, is there a way to make this template get ap...

XSLT To HTML with Simple Grouping of XML Data using templates instead of for-each

I have been messing with xslt off and on since I became a sharepoint administrator, it uses xslt alot for displaying list data. I have recently started using it to transform database results that I have converted to xml using an extension method. I am trying to produce clean html. My first attempt, worked fine. However I used for-eac...

How to "collapse" but not "normalize" whitespaces in xlst

I have an xml/tei like <p> In trattoria scoprii che c'era <del rend="tratto a matita">anche</del> Mirella, non la non vedevo da almeno sei anni. La spianata dava infatti l'impressione di fango secco, <del rend="matita">divorato dalle rughe</del><add place="margine sinistro" rend="ma...

How to copy a node set into a resultant attribute using XSLT without white space and tags encoded?

Given this XML... <?xml version="1.0" encoding="UTF-8"?> <root> <item> <this> <that>one</that> </this> </item> <item> <this> <that>two</that> </this> </item> <item> <this> <that>three</that> </this> </item> </root> I want to make copies of the items into a new for...

How to create a HTML5 + SVG document using the PHP XSLTProcessor

For a little project about XML I try to use HTML5 as it has SVG and WAI-ARIA Support. I also want to use a XSL stylesheet for my document. But I can't get a valid HTML5 document with a nested SVG. Here are some version I tested so far: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999...

Problem inserting node (text) into XML document via XSLT

Hi all: I'm having trouble inserting a block of text when a certain condition is met into an xml document using XSLT. Suppose I have the following xml: <oldStep Name="Step1"> <oldItems> <oldItem ItemName="item1"> </oldItem> <!-- want to add an extra <Item> here if Step Name == "Step1" --> <oldItem I...

Read a remote zipped xml with just XSL

Hello there I want to know if it's possible for an XSLT file to read data from an XML located within folders of a remote zip(from the server at work), without any external processors (saxon and so forth) and without downloading it. Failing that, I'll resort to just reading the information from the zip... which brings me to my other (n...

Stringbuilder vs SQL FOR XML / XSL Transform

I have an interface that loads a list of documents depending on the tab clicked by a user. I've been retrieving the data through XML from a SQL 2008 database with: SELECT col1, col2 col3 FROM documents WHERE typeId = 4 FOR XML PATH('doc'), ROOT('documents') Then tranforming the XML with an XSLT stylesheet. It all works fine. To imp...

Help displaying XML data in a table

Hi, The following is an excerpt from an XML data set: <instance> <ID>1</ID> <start>5.8633333333</start> <end>29.8216666667</end> <code>Player 1</code> </instance> <instance> <ID>2</ID> <start>28.4566666667</start> <end>51.1450000000</end> <code>Player 2</code> </instance> <instance> <ID>3</ID> <st...

Retrieving XML node from a path specified in an attribute value of another node

From this XML source : <?xml version="1.0" encoding="utf-8" ?> <ROOT> <STRUCT> <COL order="1" nodeName="FOO/BAR" colName="Foo Bar" /> <COL order="2" nodeName="FIZZ" colName="Fizz" /> </STRUCT> <DATASET> <DATA> <FIZZ>testFizz</FIZZ> <FOO> <BAR>testBar</BAR> <LIB>testLib</LIB> </FOO> ...

Selecting unique records in XSLT/XPath

I have to select only unique records from an XML document, in the context of an <xsl:for-each> loop. I am limited by Visual Studio to using XSL 1.0. <availList> <item> <schDate>2010-06-24</schDate> <schFrmTime>10:00:00</schFrmTime> <schToTime>13:00:00</schToTime> <various...

File paths with XSLT includes

Hi again everyone. I'm working on a website with a large number of pages, and each one has this in it: <xsl:include href="team-menu.xsl" /> This xsl file is stored in the root directory. Essentially including my "team menu" on each page. My problem is when I include this on nested pages, e.g. "/teammembers/smith.xsl", the links in t...