xslt

How to remove duplicate nodes using XSLT?

If system finds a duplicate , it should eliminate both nodes altogether. I have original xml as: <?xml version="1.0" encoding="utf-8"?> <RESPONSE> <RECORD> <COUNTRY_ID>2111</COUNTRY_ID> <CITY id="2:">0</CITY> <LOCATION id="1:14404388">LA11CFTXX</LOCATION> <REPID id="1:">1</REPID> <FLIGHTID id="1:1091513">ALK</FLIG...

Two Step View Pattern: XSLT vs. object graph

I intend to implement Martin Fowler's Two-Step View Pattern for rendering HTML in a web application I'm writing. The general idea is that rather than having the application output raw HTML, it outputs an custom intermediary XML which is then converted to HTML/CSS. This has a number of advantages including reduced code duplication and a ...

Using regular expressions in the Search Core Results web part XSLT

The Search Core Results SharePoint web part uses XSLT 1.0 to transform search results for display. I would like to manipulate some of the result text using regular expressions. Alas, XSLT 2.0 (containing regular expression support) is not available and Microsoft don't currently plan to implement it! One thought was to override the web p...

convert an xs:float value to a hex-string representation of its binary value

using xsl 2.0, how would you convert an xs:float value to a hex-string representation of its binary value? i have no problem doing this for an integer (divide by 16 recursively and concatenate chars 0-9A-F), but float/double is stumping me. <xsl:function name="my:float-to-hex" as="xs:string"> <xsl:param name="in" as="xs:float"/> ...

XSLT - adding tags to a text() node

Hi, I am trying to implement a text filter that adds a parent node to each text node. <xsl:template match="text()"> <aNewTag><xsl:value-of select="."/></aNewTag> </xsl:template> This works fine until when I call it indirectly by: <xsl:apply-templates/> But if I call the template directly using <xsl:apply-templates select="text(...

Get rid of xml root node in xsl template output

Thank you all for the help ahead of time. I am using XSL Templates to serve as web page templates for a web framework, the end output being XHTML 1.0 Strict; it takes xml input and outputs the XHTML. It works perfectly except for 1 problem - the end output is also outputting a xml node instead of just the contents. Here is the basic xml...

XSL Attribute match case

Hey, I am debugging the xsl stylesheet of someone else and I noticed a lot of template matches aimed at hiding certain content. Ex: <tag hide="X"> So their rules go something like this. <xsl:template match="tag1[@hide='x']" /> <xsl:template match="tag2[@hide='x']" /> <xsl:template match="tag3[@hide='x']" /> There seems to be a ma...

How can I create a Word document using Python?

I'd like to create a Word document using Python, however, I want to re-use as much of my existing document-creation code as possible. I am currently using an XSLT to generate an HTML file that I programatically convert to a PDF file. However, my client is now requesting that the same document be made available in Word (.doc) format. S...

[XSLT] Choose statement messing up my variable?

I've got a choose statement that should be setting my variable but for some reason the code, though it works elsewhere, does not work in this instance. Here's my XSLT: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; <xsl:param name="url-show"/> <xsl:param name="...

How to inline CSS and javascript through XSL

I have an XSL transformation which outputs HTML. In the head element I have a CSS file reference. <link rel="stylesheet" type="text/css" href="css/styles.css"/> I would like to create a standalone HTML result without external references and thus I would like to inline the CSS styles. To prevent code duplication, I do not want to hard ...

Show items by category xml

I have an xml output like this: <data> <item-types> <entry id="1" items="5"> <category>Frozen</category> </entry> <entry id="2" items="4"> <category>Breakfast</category> </entry> </item-types> <items> <entry id="28"> <item-number>1115</item-number> ...

XSL:T Benchmarking

How would you approach benchmarking the following XSL:T process. Testing environment: a Linux server running apache, php, and mysql that is only visible behind our network: (It is not outward facing, so It cannot be remotely accessed). Note: I have considered using AB(Apache Benchmark), but I am open to anything that is available in a...

Possible to do xsl transform on dynamically generated xml?

Let's say I have an empty XML file like so: <root></root> And I want to add an element to root during an XSL transformation like so: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; <xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="yes" /> <xsl:template match="@*|node()"> <xsl...

Sort XML with C# Before Write

I have an xml document that I am creating using the loop below and the XML writer from C#. It currently works fine, but I wanted to implement a solution where every time the XML is written it automatically sorts it ascending using the driveStart field. I know people say you should do this in XSLT but I am having a hard time finding a g...

XSL test for populated field

Is there a text I can use to check if a field is populated and toggle the field's display based on the result? ...

"Regular expression"-style replace in XSLT 1.0

I need to perform a find and replace using XSLT 1.0 which is really suited to regular expressions. Unfortunately these aren't available in 1.0 and I'm also unable to use any extension libraries such as EXSLT due to security settings I can't change. The string I'm working with looks like: 19;#John Smith;#17;#Ben Reynolds;#1;#Terry Jacks...

xslt/xml byte array, to a image

I am getting back a image from SQL server as a byte[]. Can I use xsl transform to convert it into an actual image for a webpage? How, may I do so if this is possible? ...

XSLT Transformation

How would I convert the following using xslt <blogger> <post> <text>...</text> <categories>Engineering, Internet, Sausages</catgories> </post> <post> <text>...</text> <categories>Internet, Sausages</catgories> </post> <post> <text>...</text> <categories>Sausages</catgories> </post> </blogger> into...

Convert XML to Plain Text

My goal is to build an engine that takes the latest HL7 3.0 CDA documents and make them backward compatible with HL7 2.5 which is a radically different beast. The CDA document is an XML file which when paired with its matching XSL file renders a HTML document fit for display to the end user. In HL7 2.5 I need to get the rendered text, ...

client side xslt with javascript in firefox

I am using client-side xslt to transform xml files into xhtml. There have been some hurdles but I have managed to get passed all of them except this. The problem is that when I have a simple xml file like this <?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/xsl" href="./jsInFf.xsl"?> <root>hello</root> and tr...