xslt

Writing an XPath query to match elements based on attributes and content

I have some XML like this: <topics> <topic id="50"/> <topic id="51"/> <topic id="52"/> </topics> <discussions> <discussion type="foo">talked about T50 as Discussion 1000</discussion> <discussion type="bar">Food is yummy!</discussion> <discussion type="foo">talked about T52 as Discussion 1050</discussion> </discussions> Gi...

Generating a file path with double quotes in XSL-FO

Hi, I have an XML in the form <root> <image> C:/images/image1.jpg </image> </root> Now i need to use this path (C:/images/image1.jpg) in my XSL-FO in such a way that it looks like, <fo:external-graphic src="C:/images/image1.jpg" /> How i can achieve that in my XSL-FO using the path from XML?? ...

Sitecore - xslt rendering - Hide when there is no published version available

Right now when i'm setting publishing restrictions for items in Sitecore that get rendered by xslt renderings, the xslt will just output empty blocks which don't look very nice on the website. This is the xslt code i'm using to render my Sitecore item: <xsl:for-each select="$item[sc:fld('__created',.)]"> <xsl:for-each select=...

changing url xslt based on query string?

Hi, I want to create different links and want to change their navigation url based on query string. for e.g. item1. item2 item3 when i select item1 my querystring is like www.google.com?item=item1 and when i select item2 my querystring is like www.google.com?item=item1&item=item2 but this is where i m facing problem ...now if i cli...

Sums and Category Grouping with XSLT

With XSLT, how can I change the following: <root> <element id="1" State="Texas" County="Dallas" Population="2412827" /> <element id="2" State="Texas" County="Harris" Population="3984349" /> <element id="3" state="Georgia" County="Fulton" Population="1014932" /> <element id="4" state="Georgia" County="Richmond" Population="212775...

How to check XML attribute existence using XSLT.

Hello to all. About week age I asked the question here and got a great help. Now my question has continuation. Originally I had to convert XML into text file. Here's a sample XML file: <DOC xsi:noNamespaceSchemaLocation="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt; <DOC_REQUISITES DOC_DATE="2009-04-23" DOC_NO="99999999...

Schema of an XSD?

I'm looking for the Schema document on basis of which an XSD is created. I need this because I want to transform an XML to XSD using XSL. ...

XML: Process large data

Hello What XML-parser do you recommend for the following purpose: The XML-file (formatted, containing whitespaces) is around 800 MB. It mostly contains three types of tag (let's call them n, w and r). They have an attribute called id which i'd have to search for, as fast as possible. Removing attributes I don't need could save around ...

I want to improve performance of xslt

I have a framework that generates the XML, based on the HTTP request and the current session state. I may test in HTML, but production output will be VXML - perhaps one or two "flavors" for different reasons. Here's the slow part of my HttpServlet: jsp InputStream ms = new java.io.ByteArrayInputStream(sb.toString().getBytes()); Source...

XSLT: contains() for multiple strings

I have a variable in XSLT called variable_name which I am trying to set to 1, if the Product in question has attributes with name A or B or both A & B. <xsl:variable name="variable_name"> <xsl:for-each select="product/attributes"> <xsl:if test="@attributename='A' or @attributename='B'"> <xsl:value-of select="1"/> </xsl:i...

XSLT parse escaped HTML stored in an attribute and convert that attribute's content into element's content

Hello Guys, I'm stuck on what I think should be simple thing to do. I've been looking around, but didn't find the solution. Hope you will help me. What I have is an XML element with an attribute that contains escaped HTML elements: <Booking> <BookingComments Type="RAM" comment="RAM name fred&lt;br/&gt;Tel 09876554&lt;br/&gt;Emai...

SXXP0003: Error reported by XML parser: Content is not allowed in prolog.

Hi , My XML file is <?xml version="1.0" encoding="ISO-8859-1"?> <T0020 xsi:schemaLocation="http://www.safersys.org/namespaces/T0020V1 T0020V1.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.safersys.org/namespaces/T0020V1"&gt; <INTERFACE> <NAME>SAFER</NAME> <VERSION>04.02</VERS...

XSLT 1.0 How to extend with fn (function namespace)

Hello everyone, I was wondering how I can possible extend XSLT 1.0 so that I can use functions from fn function namespace at http://www.w3schools.com/Xpath/xpath_functions.asp I was just told that the system is using MSXML XSLT processor from now on. All my stylesheets were written in 2.0 ... So now I'm stack, nothing is working and d...

Conditional templates based on global variable.

I want to copy most of the XML as is except for a couple of nodes that depend on the company which will be passed in to the stylesheet. If I have am using an identity template and I only want something to happen if a global variable equals a specific value, how do I make that happen since you can't put a check in the match between the [...

How to transform part of an XML schema in to html input form with xslt

I have a xml schema that contains information that I would like to use to dynamically create input forms in asp.net (c#). Is it possible to dynamic create controls in asp.net by transforming the schema with an xslt stylesheet? I would like to read a schema into an XmlDocument object (C#) and transform it with an XSLT stylesheet creating...

Comma split function in XSLT 1.0

I have a parameter in which I'm having information like: "item1,item2,item3,item4" So this could be 1 or 2 or 3 or 4. I want to split it and process it individually. Any idea how to achieve this? ...

<?xml-stylesheet?> if given before <?xml?> doesn't work in firefox.

i am generating an XML file using JAXB. First i write a <?xml-stylesheet?> instruction to FileOutputStream and then marhal my data to this FileOutputStream. i specify the name of file in FileOutputStream with .xml extension. Now, my xml gets generated as desired and works fine in IE but fails in Firefox. Seems that Firefox expects <?xml...

How can I populate javascript array using XSLT (Reading values from XML)

Hi, I have the following requirement. I need to populate a javascript array with values reading from an input XML file using XSLT. I just need to read XML using XSLT and populate an array in javascript. Can anybody has any idea regarding this, it would of great help to me. I am struck at this point. i can't proceed any further without ...

Are there any XSLT to C++ compilers available?

I found only one attempt to create such compiler - http://sourceforge.net/projects/xsltc/. But this project is dead for decade already. Are there any other examples? Opensource or commercial? Are there any fundamental technical difficulties with building such software? With the whole approach of compiling XSLT natively? I suppose there...

How to embed HTML produced by C# code in XSL?

I have XSLT that creates HTML from XML. There are several parts of the resulting HTML that I need to create by external C# method (extension method). How do I embed this C# method into XSLT (within what xsl nodes? I do know how to use common extension functions inside XSLT) What should my C# function return? HTML-formatted string? Wi...