xslt

Retain number of digits during processing input->number->output during XSLT processing

For this XSLT: <xsl:variable name="source0" select="number(num2)"/> <xsl:variable name="source1" select="number(num3)"/> s0 plain: <xsl:value-of select="$source0"/> s1 plain: <xsl:value-of select="$source1"/> test11: <xsl:value-of select="format-number($source0, '#.#')"/> test12: <xsl:value-of select="format-numb...

need to merge xml nodes based on an attribute value

I need to merge certain xml nodes based on an attribute value, change that attribute value on the merged node and sum another attribute. I am able to change the value of the attributes, but I couldn't figure out how to sum(@count) and assign it to @count on the resulting xml Source xml <xml> <books category="X" count="2"> <book nam...

Using XSL to sort XML data then output an XML file to be read by Classic ASP

Hi, Hopefully this will be a simple fix. I'm completely new to XSL but I've managed to get a little script that sorts my data by date. I now want to use ASP to limit this data to all entries within a month (this works by using a DateDiff() function). When I go to load in the XSL scripts output it says that my XML is malformed. Can anyon...

How to call a dot net asssembly / namespace in XSLT

I am writing dot net code within my XSLT. It gives me below error when I call any namespace OR write "using" directive within XSLT. Error- "Could not recognize 'com.myassembly' " Is it possible to use any assembly within xslt? ...

using xsl displays nothing

i'm trying to implement an xsl file to an xml doc. however when i do so, it displays nothing. if i remove the reference of the xsl from the xml file, the data at least is displayed. this is the xsl code: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; <xsl:temp...

dot net namespace error in XSLT 2.0

I get below error on calling dot net code within my XSLT file error: The type or namespace name 'com' could not be found in the global namespace (are you missing an assembly reference?) This is code snippet- <msxsl:script language="C#" implements-prefix="callCode"> <msxsl:using namespace="global::com.myassembly.crs.app.services.conten...

Determining whether a node is contained within another node in XSLT

Is it possible to tell whether a node is contained within (or equal to) another node in XSLT? For example, consider this code snippet: <xsl:variable name="itemSection" select=".."/> <xsl:for-each select="key('enemyItems', @key)"> <xsl:variable name="enemyList" select="./attributes/@value"/> <xsl:variable name="enemyListSection"...

Check how many characters are in a variable XSL

Hi there basically I need to find how many characters are in a variable using XSL if characters($Title == 12) { execute code; } Basically something like above obviously this is incorrect can any one help? thanks in advance ...

XSL QUESTION: alternative method to count the number of lines or newline characters of an xml attribute

I've scoured the internet to discover this method of finding the number of lines in an xml element.: <xsl:if test="string-length(@Example) - string-length(translate(@Example, '&#xa;', '')) &lt; 10"> In the example above, @Example is the element for which the number of lines is counted. I didn't like this code, however, because it aut...

passing parameters in xml

i'm trying to implement paging in xml using this code and got around to making it work. while it works perfectly, there is a small issue, that when i click on the NEXT button, it keeps reloading the page with the same initial records. it does not take the user to the next page. i came across this link wherein the poster had a similar ...

How to speed up XSL Transformations?

Is there any way you can speed up XSL transformations? I am using the XSLCompiledTransform class to transform my XML files. My XML files contain around 3900 records with roughly 100 fields within each record. The transformation file for this is around 10 KB in size. It takes about 25 - 30 minutes before I see the transformed file. I a...

transform from tree of elements to tree of attributes

My source document is: <?xml version="1.0" encoding="UTF8"?> <definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:fn="http://www.w3.org/2005/xpathfunctions" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance" xsi:schemaLocation="http://...

css in xsl document

how do i implement css in xsl file? i tried this: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; <link rel="stylesheet" type="text/css" href="dxsl.css"/> <xsl:output method="html" /> but it threw the error: XSLTProcessor::importStylesheet(): Found a top-level...

accessing xml attributes in xsl

i've this xml code: <title xml:lang="ar">أربيك</title> <title xml:lang="en">English</title> which i'm formatting in xsl: <div class="title"> <xsl:value-of select="root/title"/> </div> however, this^ only displays the arabic title, and not the english one. i tried this code: <div class="title"> <xsl:attribute name="...

XSLT to transform a XHTML document

I am new to XSLT but it was suggested to me as a way to accomplish a specific task. I have a bunch of xhtml files that I would like to remove a sidebar from. The sidebar is contained in a <div class="foo"> element. I can successfully perform the identity transform using the instructions in this answer: http://stackoverflow.com/questions...

xslt produces a result that does not end with a carriage return (newline)

Hi all, I have an xslt script that transforms an xml file to another xml file. The problem I'm having is that the resulting xml file does not end with a newline like a well behaved linux file. I'm using <xsl:output method="xml" indent="yes"/> for the code to be nicely idented. Is there a way to tell xslt that this is Linux mode, and i...

Combining <xsl:param> and <xsl:include>

I'm trying to make a website more dinamically with splitting it in parts. I had a XML file for the first page that now has been converted to 4 files: index.xml, menu.xml, sidebar.xml and footer.xml. (Updated) I include correctly the XML's on the index.xsl file. Now I need to include the .xls that they will use. Actually I've it all in ...

Highest sum of values per group in XSL

There is probably a very easy solution for this problem. I could easily do this in C#-LINQ. Unfortunately, I'm not so experienced with XPath and XSL. I have an input XML file that contains the following structure: <group> <val>1</val> <val>3</val> <val>1</val> </group> <group> <val>3</val> <val>2</val> <val>2</v...

C# consolidate namespace references in xml.

Hi, I have xml formatted by the atom formatter. The atom formatter seems to specify namespaces inline multiple times. Is there any way to easily consolidate these. The example below shows namespaces specified three times for each property. This is horrible. I would like prefixes at the top of the document and no namespaces in the docu...

Tree navigation with XML and XSLT

I have this tree structured XML (toc.xml): <?xml version="1.0" encoding="utf-8"?> <toc> <item name="top" key="4294967296" subkey="1"> <item name="child1" key="4294967611" subkey=""> <item name="child2-1" key="4294961611" subkey=""> <item name="child3-1" key="4294967613" subkey=""/> <item name="child3-2" key="...