xslt

Trying to use an XSLT for an XML in ASP.NET

Hello, i have the following xslt sheet: <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:variable name="nhits" select="Answer[@nhits]"></xsl:variable> <xsl:output method="html" indent="yes"/> <xsl:template match="/"> <div> <xsl:call-template nam...

issue with a xmlns

Hello, I have an xml file and an xslt file. The xml file has a xmlns="exa:com.test" attribute. If i remove this attribute in the xml the xpath sentences in my xslt works. But if i leave it, doesnt work. Im using the following code to mix xml and xslt: XslCompiledTransform transformer = new XslCompiledTransform(); transformer.Load(...

XSLT: look for a word and its context

Hello! I need to search a word and its context into an xml. For example <line>hello world, my name is farhad and i'm having trouble with xslt</line> looking for 'and', context of 3 words: <line>hello world, my <span class="context">name is farhad <span class="word">and</span> i'm having</span> trouble with xslt</line> How can i do?...

Transforming XML in a SAP BusinessObjects report

We have a database that has columns containing XML. We need to create some reports in SAP BusinessObjects. The reports are very simple, but in the output we'll need to transform the chunks of XML into something human readable. I'm entirely new to BusinessObjects - can I do XML transforms in a BusinessObjects report? ...

XML Timezone remove

I have a Date coming from SQL 2010-05-11 10:30:00 But when i applyc XSL it is adding the 2010-05-11T10:30:00-04:00 time zone offset. Is there any way we can remove that from XSL. ...

Find value in sequence using XSL

I want to check if a value exists in a sequence defined as <xsl:variable name="some_seq" select="/root/word[@optional='no']/text()"/> In the past, I've had success with Priscilla Walmsleys function. For clarity, I reproduce it here as follows: <xsl:function name="functx:is-value-in-sequence" as="xs:boolean"> <xsl:param name="valu...

XSL: Parsing XML to HTML - How do I use value-of an element data as an html attribute?

<input src="LOGO.JPG" type="image" name="imagem"> I have an xml element that contains the image path that needs to be displayed in HTML after the parse. <xsl:value-of select="image"/> returns the string that is stored in the image element but how can I use it to make that string be the src atribute value in an html tag? I tried <input ...

Easiest way to get current unix timestamp via XSL

What is the easiest way to get current unix timestamp via XSL ...

Eclipse can't find xsl template in another file in the same directory

I have three xsl documents in the same folder: ooo2xslf0-writer.xsl which contains images.xsl which calls a template called apply-border in borders.xsl Now, ooo2xslf0-writer.xsl contains: <xsl:include href="images.xsl" /> <xsl:include href="borders.xsl" /> And so I assume that apply-border is available for images.xsl when it nee...

How to select distinct values from XML document using XPATH?

How can I select only distinct elements for the XML document using XPATH?I've tried to use the 'distinct-values' function but it didn't work for some reason.. The XML is similar to the following: <catalog> <product> <size>12</size> <price>1000</price> <rating>1</rating> </product> <product> <size>10</size> <price>1000</price> <rating...

XSLT: opening but not closing tags

Is there a way to open a tag and not close it? For example: <xsl:for-each select="."> <span> </xsl:for-each> This is my code: http://pastebin.com/1Xh49YN0 . As you can see i need to open on a when tag and close it on another when tag (row 43 and 63). This piece of code is not valid because XSLT is not well formed, but is ther...

XSLT; parse escaped text to a node-set and extract subelements

Hello SO; I've been fighting with this problem all day and am just about at my wit's end. I have an XML file in which certain portions of data are stored as escaped text but are themselves well-formed XML. I want to convert the whole hierarchy in this text node to a node-set and extract the data therein. No combination of variables and...

Merge two xml schemas using XSLT

I'm transforming an XML Schema using XSLT 2.0. The first schema (s1.xsd) imports a second schema (s2.xsd) as follows: Content of s1.xsd <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema.xsd" xmlns:ns1="URI1" targetNamespace="URI2" elementFormDefault="qualified" attributeFormDefau...

Problem with using the XPATH functions

I've got a problem with using the XPATH functions. When I try to call some functions like lower-case or upper-case etc,they are not executed and I can't figure the problem out. I included the namespace xmlns:fn="http://www.w3.org/2005/xpath-functions" at the top of my XSL stylesheet and use fn namespace to call these functions but anyway...

How can I use xsl stylesheet parameters to set a node name in XPATH expression?

I have the following XPATH expression: select="catalog/product/$category_name = $category_value" In the given example $category_name and $category_value are the XSL parameters that I receive from my servlet and I want to use them in XSL to filter the XML result based on category and its value.However, for some reason when,say, $catego...

In XSLT, how can you sort using an indirect key?

I am having trouble getting xsl:sort to understand the scope of the attributes I am referencing. Here is an XML sample document to illustrate: <Root> <DrinkSelections> <Drink id=1000 name="Coffee"/> <Drink id=1001 name="Water"/> <Drink id=1002 name="Tea"/> <Drink id=1003 name="Almost But Not Quite Entirely Unlike Tea"/...

How does one do a null check for a Guid in xslt?

I am trying to edit an xslt file. One line reads: <xsl:if test="number(./@LatestAuthor) &gt; 0"> The issue I have is that latest author used to be of type int and is now a nullable Guid. How can I edit the xslt file to check if @LatestAuthor is not null? Thanks. ...

How do I alter the XML DOM with javascript, when using XML+XSLT client side.

For example: XML: <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="example.xsl"?> <document> <foo>bar</foo> </document> XSL: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; <xsl:template match="/"> <html> <head> <title>example</title> ...

Reorder nodes in xml using xslt

Hello, How I can transform a xml like this: <xml> <paragraph> <data> <label> title </label> </data> <data> <label> subtitle </label> </data> <data> <label> text </label> </data> <data> <label> image </label> </dat...

Is XSLT worth investing time in and are there any actual alternatives?

I realize there have been a few other questions on this topic, and the general concensus is to use your language of choice to manipulate the XML. However, this solution does not quite fit my circumstances. Firstly, the scope of the project: We want to develop platform independent e-learning, currently, its a bunch of HTML pages but as t...