xslt

<a> tag under <xsl:variable> not working

Hi all, I have declared one variable in xslt, assigned some value to it but while retrieving the value I am facing some problem. <xslt:variable name="Msg"> Hello for more info <a href="http://someurl/"&gt;click me.</a> </xslt:variable> while retrieving the value the content is coming a...

How to add times in XSLT?

Hello, I have some output from 3rd party software: Sample XML from the software: <testsuite name="XYZ"> <testcase name="ABC" status="0" time="12.001">Some stuff</testcase> <testcase name="DEF" status="0" time="12,345.001">Some stuff</testcase> <testcase name="GHI" status="0" time="4,321.001">Some stuff</testcase> ...

How to get the value of an attribute of the root element in XSLT?

I have this XML: <?xml version="1.0" encoding="utf-8" ?> <IMPORT mode="FULL"> .... </IMPORT> I'm trying to convert it with the following XSLT stylesheet: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; <xsl:template match="/"> <xsl:element name="im...

How to nest xsl:for-each selec

HI! My XML: <?xml version="1.0" encoding="ISO-8859-1"?> <!-- Edited by XMLSpy® --> <Dokument> <Skupina id="3"> <Naziv_skupine>RAZSTAVNI PROSTOR</Naziv_skupine> <Dvorana id="295"> <Naziv_dvorane>DVORANA C</Naziv_dvorane> <Postavka id="41"> <Artikel>1105</Artikel> </Postavka> ...

XSLT remove xmlns attribute

I am trying to remove the attribute xmlns="http://webdev2003.test.com" from the following xml using xsl/xslt, a requirement of the XML Task in SSIS. What is a proper methodology considering a large file size. ~40mb <?xml version="1.0" encoding="utf-16"?> <ArrayOfAccount xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="h...

Can I parse an HTML using XSLT?

Hi I have to parse a big HTML file, and Im only interested in a small section (a table). So I thought about using an XSLT to simplify/transform the HTML in something simpler that I could then easily process. The problem Im having is that the is not finding my table. So I don't know if its even possible to parse HTML using a XSL styles...

Testing if XML element exists in XSLT

This is probably a really easy answer, but for the life of me I can't figure it out. I want to display certain content depending on which child element is being displayed but I don't know how to test for the element I want. I want to see if the start, stop, and note elements exist <xsl:template match="protocol[@id=$protocolNumber]"> <h...

XSL: Using external VB functions with XSL

I have a visual basic file with a number of functions I want to use inside my XSL. I can build it as a dll and reference in my XSL project but I don't know how to reference it in my XSL file. I am using visual studio. I get the error "Cannot find the script or external object that implements prefix..." I want to do something like: xml...

Evernote export format (ENEX) to HTML, including pictures?

@Solved The two subquestions I have created have been solved (yay for splitting this one up!), so this one is solved. I'll award the check mark to samjudson, since his answer was the closest. For actual working solutions though, see the below subquestions; both my implemented solutions and the checked answers. @Deprecated I am splitti...

XSL recursive sort

Hello, I am facing a problem where I need to sort elements, depending on their value, which contains a numbers, separated by periods. I need to sort elements depending on the value of the number before first period, then the number between first and second periods and so on. I don't know, how deep this hierarchy can go and that is the bi...

How do I render an array of Java beans to XML with struts2?

My output should be something like this: <result> <item> <id>123</id> <src>123</src> <dst>123</dst> </item> <item> <!-- ... --> </item> </result> And the action class would have a method getFoos which returns an array of uniform objects, e. g. like this: class Foo { // ... public long getId() { ... } // .....

"(503) Server Unavailable" with call to XSL Transform in Windows Server 2008

So I run this Windows Server 2008 security update and this code block is now throwing an error: using(MemoryStream ms = new MemoryStream()) { xslt.Transform(navigableSet, xslArgs, ms); ms.Position = 0; ret = new XPathDocument(ms); } return ret; The error is EXCEPTION [System]: The remote server returned an error: (503) Ser...

cdata in xslt for html

I have an XSLT file generating plain HTML. I need to wrap some elements in CDATA blocks, so intend to use cdata-section-elements. But, if the element I want to have contain CDATA is only one <p> on the page, how do I get it to not put CDATA in all the other <p> elements? The input data is this: <item> ... <g:category>Gifts under &a...

Problem with &apos; being translated into ' when processing with xlst

I have a .xslt that translates xml from one form to another (I'm not using and xsd so I will not say from one schema to another). My problem is that the original file's encoding of ' is lost in translation. This causes me a problem because in my database the names are stored using the apostrophe character not the single quote character...

XSLT - Match element with multiple child elements

<xsl:template match="element[child]"> The above works. What is the real syntax for the following pseudo-syntax? : <xsl:template match="element[child1 AND child2]"> In the place on AND: and doesn't work & doesn't work , doesn't work What is it? Thanks. ...

how to check whether the value of a string variable is Yes or No?

How can I check whether the value of a string variable is Yes or No? <xsl:variable name="test1" select="DBE:OBJECT/DBE:ATTRIBUTE[@name='test1']/DBE:String"/> <xsl:variable name="test2" select="DBE:OBJECT/DBE:ATTRIBUTE[@name='test2']/DBE:String"/> <xsl:choose> <xsl:when test="$test1 = 'Yes'> <xsl:apply-templates select="YES"/> </xsl...

What are the XSLT processor for .NET?

I'd like people's opinion on the "best" XSLT processor for .NET, but what are the good options for processing XSLT in .NET? What do you use and how well does it serve you? ...

Something like xslt for presenting plain-text EDI messages?

I often encounter EDI messages in various plain text formats, for example the format: HEAD[customer,8][date,8][reference,10] [lineno, 3][product, 8][quantity, 3][currency, 3][price, 10]... ..resulting in messages like this: HEAD1122334420091031 LINDAHL 00100004711010USD0000234055 00200004712005USD0000004543 ... Reading the above ...

how to check with 2 conditions for test in xsl:when

I would like to check the values of test1 and test 2. If test1 evaluates to Yes then display Yes, if test2 evaluates to Yes then display Invalid else display the exact value of test1. I tried the below xsl:when test="$test1 = 'Yes' or 'Yes'"> <td> Yes </td> /xsl:when> xsl:when test="$test2 = 'Yes' or 'yes...

Replacement for saxon:if and saxon:before functions in xslt 2.0

Is there any replacement for saxon:if and saxon:before functions in XSLT 2.0 / XPath 2.0? I have code like this: <xsl:variable name="stop" select="(following-sibling::h:h1|following-sibling::h:h2)[1]" /> <xsl:variable name="between" select="saxon:if($stop, saxon:before(following-sibling::*, $stop), ...