xslt

How to apply an alphanumeric sort in XSLT

Based on the following XML, what is the best way to achieve an alphanumeric sort in XSL? Edit: to clarify, the XML below is just a simple sample the real XML would contain much more variant values. <colors> <item> <label>Yellow 100</label> </item> <item> <label>Blue 12</label> </item> <item> <label>Orange 3</label...

Manipulate the output of <xsl:apply-templates>

How do I string manipulation on the output of <xsl:apply-templates>? I need to escape quotes etc as it's finally being passed to a JavaScript variable. ...

XSL transformation spacing

Hi, I'm using Xsl transformation to display an Xml data as Html. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ms="urn:schemas-microsoft-com:xslt" xmlns:util="urn:the-xml-files:xslt"> <xsl:output method="xml" indent="yes" omit-xml-declaration="yes" encoding="utf-8"/> <xsl:template match=...

How do I replace quotes in XSLT with their HTML entities?

This is related to my previous question -" Manipulate the output of <xsl:apply-templates>". I want to ask about the specific problem I am looking to address. How do I replace quotes in XSLT with their HTML entities. I want to eventually pass it to Javascript variable with special characters escaped. ...

Finding max of three numbers in XSL

How can find max of three numbers in XSL ? More Information : I have three numbers say 1.0, 2.0, 5.0....I don't have any nodes set... I would like to find maximum of 1.0, 2.0 and 5.0..... Example : AIM : TO know which type of node <MYNODE>, <DOC>, <PIC> is having maximum count and whant's the count number ? <ROOT> <...

How to create node set from values

How can we create a node set from values.... I have n numbers 1,2,3.......n. I want to create a node set <MYNMUMS> <MYNUM>1</MYNUM> <MYNUM>2</MYNUM> <MYNUM>3</MYNUM> <MYNUM>4</MYNUM> .... <MYNUM>N</MYNUM> </MYNMUMS> ...

XSLT: Merge nodes, then sort

I have a XML like this: <node id="1"> <data alias="Show">ShowName1</data> <data alias="Dates">21/04/2009,23/04/2009,27/04/2009,</data> </node> <node id="2"> <data alias="Show">ShowName2</data> <data alias="Dates">22/04/2009,25/04/2009,29/04/2009,</data> </node> It has X number of nodes, each with a name of a show, and...

Is there tool to construct XSL/XSL-FO with GUI?

Hello all is there any good tool to construct XSL and XSL-FO from XMLs / SQL queries but as GUI designer? Thanks ...

how can i store rich text formatting in XML that pulls out to my page formatted

I am storing user inputs through a form with wiki style formatting (text for bold, _text for underline, etc) in my database. I was planning to use the db functions & some page code to store all of the info out to XML with the proper html formatting for each rich text field included. From there the XML gets parsed with an XSL stylesheet. ...

xslt test if a variable value is contained in a node set

I have the following two files: <?xml version="1.0" encoding="utf-8" ?> <!-- D E F A U L T H O S P I T A L P O L I C Y --> <xas DefaultPolicy="open" DefaultSubjectsFile="subjects.xss"> <rule id="R1" access="deny" object="record" subject="roles/*[name()!='Staff']"/> <rule id="R2" access="deny" object="diagnosis" subject="roles//Nurse"...

How to use XPath/Xsl to compare child element with the same child element under a different parent ?

I need to use xsl/xpath (version 1.0) to do something special (for simplifying, say insert some dummy text) when the value of SupplierId changes. I need to handle 3 variations; Do something when on the first Order (the first occurence of SupplierId) Do somwthing when on OrderId O3 (SupplierId changed from S1 to S2) Do something when o...

How to get current country-code/locale in XSL?

I am using XSL transform on XML. Some part of transform are dependent on current locale. Is there any way to find the current locale from within XSL? For example, the user-visible serialization of a floating point number can vary between locales ("1.0" in English is "1,0" in German), and my transform needs to take differences like these...

XSLT concat string, remove last comma

I need to build up a string using XSLT and separate each string with a comma but not include a comma after the last string. In my example below I will have a trailing comma if I have Distribution node and not a Note node for instance. I don't know of anyway to build up a string as a variable and then truncate the last character in XSLT. ...

How can I allow for user definable XML file formats?

I want to allow users to upload files with transaction information to my application. I want users to be able to user their own file format when doing so (XML or CSV). So I'm going to need a transformation from their format to my format before doing further processing. I don't want to have to create this XSLT manually every time a use...

How to limit string word count in XSLT 1.0?

How can I limit a string's word count in XSLT 1.0? ...

Why choose an XSL-transformation?

For a current project the decision has to be made whether to use XML and an XSL-transformation to produce HTML or to directly use HTML-templates. I'd be interested in arguments for or against the XSL-approach. I understand that in cases where you have to support many different layouts, an XSL-solution has a lot of advantages, but why wo...

How can I calculate the absolute value of a number in XSLT?

I have <xsl:value-of select="DifferenceInDays" /> DifferenceInDays can be negative or positive, I want to display it as positive. How can I do this? ...

Blank xmlns="" Attributes From Import

Hi all, I'm attempting to do a transform on an XML document. My XML transform can result in two different types of base element depending on the value of a certain element: <xsl:template match="/"> <xsl:choose> <xsl:when test="/databean/data[@id='pkhfeed']/value/text()='200'"> <xsl:call-template name="StructureA"> ...

Produce context data for first and last occurrences of every value of an element

Given the following xml: <container> <val>2</val> <id>1</id> </container> <container> <val>2</val> <id>2</id> </container> <container> <val>2</val> <id>3</id> </container> <container> <val>4</val> <id>1</id> </container> <container> <val>4</val> <id>2</id> </container> <container> <val>4</val>...

querystring using xslt

is it possible to access a query string using xslt? i have a url e.g www.example.com/page.aspx?k=aa&lang=en I want to do something like if lang = en <div>displaly stuff</div> else <div>display other stuff</div> can you show me how to do this using xslt? ...