xslt

xsl transform for WTF "well formed" example

i laughed out loud when i read this article on Daily WTF : http://thedailywtf.com/Articles/WellFormed-XML.aspx, but now it's not funny anymore because i have begun to recognize this "xml design pattern" in the wild with alarming frequency. for example, i just exported some data from a rational clearquest query and i got this: <?xml ver...

XSLT and dynamic table columns

Hi, I have developed an XSL file that transforms xml files into a html table. The idea is to have only one xsl file transform many xml files into a html table, instead of having 10 xml files with 10 accompanying xsl files. I've included the one xsl file and 2 xml files that uses the xsl file to transform them into a html tables. The pro...

Sharepoint date manipulation and filtering

I'm having a real problem trying to filter a sharepoint list by date. I want to produce a list of months/years where for each entry there is a count from the list, where the counts include dates that are greater than or equal to the 15th of that month, or less than the 15th of the following month. I can do this fine for any month excep...

How to implement sorting using xslt on href

Hi Guys, I am using xslt and I want to implement sorting on my href link. below is the xslt part where I need to implement sorting. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:tlink="urn:TridionLinking" xmlns:msxsl="urn:schemas-microsoft-com:xslt"...

Omitting all namespaces from XslCompiledTransform.Transform output

How can I omit all XML-Namespaces from the xslt in the html-output? My XSL starts with: <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions"&gt; and my code to transform the X...

XSLT, Doctype and Google-Map v3 not working

Hello, I'm trying to include a GoogleMap v3 (everything was okay with v2) in my HTML pages generated with XLS Transformations. My JS code comes from this page. Basically, the map works correctly when everything is in plain HTML, as per the example, however when I try to include it in the XSL stylesheet, Firefox (v3.6) complains and doe...

Distinct nodes on multiple keys with XSLT

Hello, i would like to get distinct nodes from my xml on multiple levels. Can anyone please give me some hints how to do this? The methods i googled (Muenchian method, for-each-group) were explained with single grouping keys and plain hearchie. Here's an example of my xml: <persons> <person> <name>Tom</name> <age>20</age> <mail...

How to assign value to empty element tags in xml(self closed elements) using XSLT

Hi how to convert the following empty element tag in the following xml <LIST_R7P1_1> <R7P1_1> <ORIG_EXP_PRE_CONV /> <EXP_AFT_CONV /> <GUARANTEE_AMOUNT /> <CREDIT_DER /> </R7P1_1> </LIST_R7P1_1> to the following format using xslt <LIST_R7P1_1> <R7P1_1> <ORIG_EXP_PRE_CONV >0<ORIG_EXP_PRE_CONV /> <EXP_AFT_CONV >...

How can I speed up my 'divide and conquer' XSLT template which replaces certain characters in a string?

UPDATE: I added an answer to this question which incorporates almost all the suggestions which have been given. The original template given in the code below needed 45605ms to finish a real world input document (english text about script programming). The revised template in the community wiki answer brought the runtime down to 605ms! I...

Use XSL to keep only first paragraph of RSS <description> field

I am trying to work with this RSS feed. I would like to use XSL to keep only the first paragraph of the description field. I have read up on how to target only certain children of an XML structure, but I think because the paragraph tags in the RSS feed are added as &lt and &gt they don't seem to work when doing something like this: <xs...

XSL beginner question

I want to understand, in general, what this means: <xsl:template match="foo:barLists[@mode = 'Dummy Filter']" mode="dummy-filter-cache" priority="2"> I'm looking for some insight to what this does so I may learn a bit about XSL ...

Looking for free lightweight xslt editor

As stated I'm looking for a free lightweight xslt editor with following functionalities: Intellisense support Simple to use (ie. can copy/paste xml & xsl into it and run the transformation) Can be used to preview resulting html Runs on Windows Something like xmlspy used to be like (before it got pricey and full of features noone uses...

Using XSLT to change surrounding data based on an empty tag.

In the process of trying to make a stylesheet to convert old LoC transcriptions of books that used a very-outdated SGML DTD for formatting, I've run into a roadblock at the following situation: In the converted XML files, there are some lines of text like the following: <p> Text on left <hsep></hsep> Text on right </p> hsep essentiall...

Quick beginner XSLT reference?

I need to learn XSLT for Wordpress andSymphony theming. What are some beginner friendly resources that are relatively easy to follow along to? ...

How to count the xml node inside xml element using xslt

hi Guys, I am using XSLT to generate my HTML. I am having below xml and I want to write condition if there is only one city node inside a country node I want to write some condition, please see the below xml. There are two xmls. 1) destinations.xml <?xml version="1.0"?> <list type="Destinations"> <resources location="in...

url gets appended in href

Hi I have this code <xsl:choose> <xsl:when test="string-length(externalurl) &gt; 0"> <xsl:attribute name="href"> <xsl:value-of select="externalurl" /> </xsl:attribute> </xsl:when> <xsl:otherwise> <!--<xsl:value-of select="externalurl" />--> </xsl:otherwise> </xsl:choose> Now the page path gets appended to the external...

How to handel empty elements during doing sum of elements using xslt

<LIST_R7P1_1> <R7P1_1> <ORIG_EXP_PRE_CONV /> <EXP_AFT_CONV >34<EXP_AFT_CONV /> <GUARANTEE_AMOUNT /> <CREDIT_DER /> </R7P1_1> </LIST_R7P1_1> <total><xsl:value-of select="LIST_R7P1_1/R7P1_1/ORIG_EXP_PRE_CONV + LIST_R7P1_1/R7P1_1/EXP_AFT_CONV + LIST_R7P1_1/R7P1_1/GUARANTEE_AMOUNT + LIST_R7P1_1/R7P1_1/CREDIT_DER"/></total> I...

How can I select nodes from a tree whose markup is stored in a variable?

Consider the following XSLT script: <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; <xsl:output method="text" encoding="iso-8859-1"/> <xsl:variable name="stringmap"> <map> <entry><key>red</key><value>rot</value></entry> <entry><key>green</key><value>gruen</...

XSL hyperlink rewriting without recreating the element

Hi, I worked out an XSL template that rewrites all hyperlinks on an HTML page, containing a certain substring in the href attribute. It looks like this: <xsl:template match="A[contains(@href, 'asp')]"> <a> <xsl:attribute name="href"> <xsl:value-of select="bridge:linkFrom($bridge, $base, @href, 'intranet')" /> ...

How to create XSD document from an XSLT ?

Hi I have an XSLT, now i need to create a new XSD document from that xslt. Please any one help. ...