xslt

How to create a table-of-contents with all levels of hierarchy?

Given the following XML document: <Include> <Feature Title="A"> <Feature Title="1" /> <Feature Title="2" /> </Feature> <Feature Title="B"> <Feature Title="3"> <Feature Title="i" /> <Feature Title="ii" /> </Feature> <Feature Title="4" /> </Feature> </Include> I need to generate a text file that l...

What is the fastest way to convert a class to XML

I would like to know what is the fastest and most lightweight technique to convert a fairly large class to XML. The class will have lists and arrays in it. I need to convert all this data to XML Here is what my application does: it will get all the information from the database using linq to enties. Then store the data in a class. Then ...

XSLT Layouts With Dynamic Content Region

I'm working on rebuilding the UI portion of our website which is all heavily javascript/ajax based (for no good reason and in a fairly inefficient way) such that the backend will now do most of the content generation. It is a C# .net application. Almost all of our pages (which there are probably 40-50 pages) have the same basic layout. ...

Adding xml nodes at a specific point using xslt

Hi all: I have the following xml and want to insert additional xml into it: <root> <steps> <step name="step1" type="process"> <steps> <step name="substep1"> </step> </steps> </step> <step name="step2" type="process"> <steps> ...

XSLT management - attaching metadata to a stylesheet for output and parameters

I am using about a dozen XSLT files to provide a large number of output formats. At the moment the user has to know the extension of the file format being exported to e.g. RTF, HTML, TXT. I would also like to use parameters to allow more options. If I can embed the metadata in the XSL file itself then I can pick up the details by scann...

Selecting nodes possessing all/any values in list

I'm looking to take a delimited list of category IDs provided in one element... <Categories>851|849</Categories> <MatchType>any</MatchType> ...and use them to style other elements... <Page CategoryIds="848|849|850|851">Page 1</Page> <Page CategoryIds="849|850|">Page 2</Page> <Page CategoryIds="848|850|">Page 3</Page> <Page CategoryId...

How to highlight table cells after checking a condition using javascript function whose values are fed by XSLT

Dear all, I am a new to JAVASCRIPT and I want to highlight table row if the values are not the same throughout the row knowing that I use a loop to extract the values from the XML file using XSLT. How can I do that? <xsl:for-each select="./projects/project"> <td> <xsl:value-of select="weight"/> <xsl...

Output DataTable XML in UTF8 rather than UTF16

Hi, I have a DataTable that I'm creating an XML file from using .WriteXML(..), although I have a problem with it exporting in UTF-16 encoding and there seems to be no apparent way of changing this. I understand that .NET uses UTF-16 internally within strings, is this correct? I'm then running the XML that DataTable.WriteXML() produces...

XSLT | Choose/When

Here is my code: <xsl:choose> <xsl:when test="$all_alerts[(g:line_abbr = 'MFL') or (g:line_abbr = 'BSL') or (g:line_abbr = 'CCT') or (g:line_abbr = 'NHSL') and (g:problem != 'normal_service')]"> <b>Subway</b><br /><br /> <xsl:for-each select="$all_alerts[g:line_abbr = 'MFL']"> <xsl:if test="g:problem != '...

XSL transformation novice needs help flattening an XML file

I'm trying convert this file: <?xml version="1.0" encoding="utf-8"?> <x12errors> <header> <errors> <issue> <message>Wrong value</message> <path>path to bad value</path> </issue> <issue> <message>Missing value</message> <path>path where missing value should be</pa...

How to include space in XML tag/element which gets transformed by XSLT into .excel sheet

I have an XML which gets transformed with an XSLT into an excel sheet on a webpage. The element tags in XML becomes column headers in EXCEL. There are columns which would like to have spaces. We don't like underscores or hyphens coming in excel sheet headers. How to I incorporate space in an XML tag/element? I tried putting or %20 or #...

Not IN equivalent in XPath expression

Hi, I am working on an XSL development and I am in need of knowing the NOT IN equivalent in XPATH. I am presenting the XML and XSL in the simplest format which would be understandable to all. <?xml-stylesheet type="text/xsl" href="XSL.xsl"?> <Message> <Customers> <Customer pin="06067">1</Customer> <Customer pin="060...

How to sort an XMl using XSLT 1.0?

I'm looking for an XSL to sort and group an XML by a node and sum by another node. I will have to use XSLT 1.0. Here is my XML. After sorting I need to have a new XML sorted and Grouped by <TransCode>, and all <TransAmt> should be summed for each group. I'm looking for the XSL for this task. Any help is appreciated. After sorting n...

Basic XSLT example

I'm just getting started using XSL to transform XML to HTML and I'm hopping to get help with the following to help me dive in. Given XML like the following (A): <Course Title="SampleCourse"> <Lesson Title="Overview"/> <Section Title="Section1"> <Lesson Title="S1 Lesson 1" /> <Lesson Title="S1 Lesson 2" /> </Section> <Se...

Apply XSLT on XML to get Formatted (colour) Output

How can I apply XSLT on following XML so string between ~ and $ becomes Red in output. The following XSLT work when you have only one string which contains ~ and $. it will not work when you have more than one string which contains ~ and $. info I am using the same template for DATAC ' I am using Java to compare Strings. I have a o...

Problem with adding xmlns attribute to XML document using XSL

Hi all: I have the following in my XSL which adds a xmlns to my XML. <xsl:template match="root"> <xsl:element name="root" namespace="myXslLoc"> <xsl:attribute name="Name">Default</xsl:attribute> <xsl:apply-templates/> </xsl:element> <xsl:template> The above does add a xmlns attribute to the root element (the t...

A good resource for learning xsl?

Hey all Know a bit of XML but am struggling to get my head around XSL - just wondering if anybody knows of any good resources to get me up to par quickly. Websites or books etc. Thanks in advance. ...

Pass an array of double as a param in xsl

Hi all! I need your brilliant mind! I have next problem: I have an xsl document and I want to pass an array as a param (or variable) to this xsl to iterate over it. <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; <xsl:include href="properties.xsl" /...

Performing a check in XSL

Hey I am trying to perform a check on individual nodes of an XML file, and depending on the contents of a specific node do something, for example if the type is bool display a checkbox or if the type is text display a textarea or a pull down options box. For example: <Questions> <Question> <Data>What gender are you?</Data> <Type>pulld...

Needing XSLT sort to treat some strings as numbers

Hi! I am unsure if this is an error, or if this is just how XSLT sort works. When I do the following: <xsl:apply-templates select="//*[@id&lt;=50000]"> <xsl:sort select="@id" /> </xsl:apply-templates> The results are not being sorted as if they are numbers. For example I would get the following results: @id 0 @id 1 @id -1 @id 10...