xslt

Modifying values with XSLT

Hi, I have XML file with values expressed in SI unit (m, N). I use an XSLT document to transform it into HTML page where I would like to display values with other units (um, mN). Is there a way to modify values I extract from my XML document using XSLT without modifying XML content before XSLT processing ? Thanks in advance for your h...

XPath to produce a result node-set containing the same node more than once?

What I tried to say in the title is: Given a bit of XML in which I know a particular element appears only once, is it possible using a single XPath query to select a node-set that contains that element twice? I understand there's a "union" operator (|) but that's basically a logical-OR, right? In SQL terms I'm looking then for the equ...

XSLT -- select child nodes based on their contents

Say I have this piece of xml: <AA> <BB>foo</BB> <CC>bar</CC> <DD>baz</DD> <EE>bar</EE> </AA> How do I select all the child nodes of <AA> that have `bar' as its contents? In the example above, I'd want to select <CC> and <EE>. I'm thinking the solution is something like: <xsl:template match="AA"> <xsl:for-each select="???"> </xsl:fo...

How to create xml from another xml meta data?

I am not sure whether the title clearly explains my problem, will try to include as much details I can. I need to convert below xml to a properly formatted one using Xslt 1, so that I can deserialize it to a .net type. Source XML <ax21:result type="test.ws.Result"> <ax21:columnNames>fileName</ax21:columnNames> <ax21:columnN...

XSLT counting elements with a given value

I need to count the number of elements in an XML file that have a particular value (to verify uniqueness). The XML file looks like this: EDIT: I updated the original "simplified" XML with the actual hairy mess someone designed. Unfortunately, this is going to make all the previous Answers really confusing and wrong unless edited. <root...

How can I provide the same form 1) Blank, and 2) Filled in, via XSLT?

I have 20 forms which I am printing using XML and XSLT. Now I need a functionality where I can print these forms as blank. For example I have a "Name" field in my XML and a corresponding <span>Name:</span> <strong class="data"> <xsl:value-of disable-output-escaping="yes" select="Name" /> </strong> I need 2 functionalities: I wa...

XSL Stylesheet won't parse XML generated by DataContractSerializer

I had some classes I was serializing out using XMLSerializer, then transforming using XSLT into various formatted emails or web service calls. All was well. We started using Linq in some parts of the data layer, and I needed to serialize out some of the Linq objects to be consumed by the XSL Stylesheets. I decided it was probably bes...

Producing a new line in XSLT

I want to produce a newline for text output in XSLT. Any ideas? Thanks ...

Xerces/Xalan: UNC path as argument for document function?

I'm transforming an XML document by using Xerces-C 2.5 and Xalan-C 1.8. The XSL contains a "document" function, that references a file on the network. Unfortunately I cannot access this file by HTTP. I've only got the UNC path. Xerces refuses to parse the referenced document, because WinSockNetAccessor::makeNew is called in Xerces as th...

XSLT - Filtering

I have a repeating xml tree like this - <xml> <head>this is a sample xml file</head> <item><color>yellow</color><color>red</color></item> <item><color>blue</color></item> <item><color>grey</color><color>red</color><color>blue</color></item> </xml> As you can see, each item can have a varying number of color tags. I wish to ge...

Want To Save xslt applied xml file with changed node value .

I have created an XSLT for an XML and its node value is displayed as text. Now I want to save the original XML file as a new file with the changed values. The values are entered by user in xml generated html textboxes. I am using windows mobile(PDA) C# .net compact framework. Loading xslt applied xml file into webbrowser control. ...

Parsing XML contained in a string using an XSL via JQuery

This is my XML: var x="<page><item>1</item></page>"; My XML is stored in a JavaScript string. I am trying to make some changes to this XML using XSL. I want to apply this XSL to this XML via JavaScript. So I have used JQuery: $('#output').xslt({xmlURL: '??',xslUrl: 'Test.xsl'}); Here the xmlURL is an XML file, but the input is a s...

how to pass a parameter from an URL to a XSL stylesheet?

I have something like this: $('#output').xslt({xml: 'x',xslUrl: 'Test.xsl'}); How do I pass a parameter to the Test.xsl file and retreive the same url in the xsl file? I am using the jquery libraries: jquery.1.1.3.js and jquery.xslt.js Or is there any way I could send a parameter to my xsl file via js or jQuery ? ...

Building list with xslt

I am trying to build a list that parses my entire xml document. I need to list the numeric names then the alpha names. The list should look something like this. 6 6600 Training 6500 Training A Accelerated Training T Training This is a snippet of the xml. <courses> <course> <name>Accelerated Training</name> </course...

How to count total number of quote in XSLT?

Hi, My question is: using XSLT, how to count the total number of QUOTE tag (please see the sample code below) The result need to be exported in HTLM, it will display like this: There are total 6 quotes <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="text.xsl" ?> <quotes> <quote>Quote 1 </quote> ...

HOw to make the text repeat only once every for-each?

for example I have the XML code like this: <quotes> <quote> <character> <name>LA FEU</name> </character> </quote> <quote> <character> <name>LA FEU</name> </character> </quote> <quote> <character> <name>LA FEU</name> </character> </quote> </quotes> My XSLT code to transform this ...

problem with using XPath to locate some part of XML

Duplicate of HOw to make the text repeat only once every for-each? I have problem with using XPATH to point to some element in XML. Here is my XML code: <character> <name>some name </some name> </character> </quote> <quote> .... </quote> </quotes> and here My XSLT code: <xsl:for-eac...

What's so bad about xsl:for-each?

I hear time and time again about how you should avoid the use of XSLT for-each. That it's your inner imperative programming demon that should be banished. What's so bad about it? Does this best practice matter depending on the size of XML (i.e 100 vs 10,000 nodes)? ...

Filtering most out of XML with XSL?

I need to transform a lot of XML files (Fedora export) into a different kind of XML. Trying to do it with XSL stylesheets and checking with the msxsl transformer. Supposedly I have xml file like this (assuming there are actually other nodes inside AAA, OBJ, amd all other nodes), Source.XML: <DOC> <AAA> <STUFF>example</STUFF> <O...

Rename XML elements using XSLT

I need to change some of the element names in the original XML. I am trying to do this with XSLT, but can't get it to work. Here is a sample of XML: <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="test.xsl" type="text/xsl"?> <html> <body> <section>Jabber</section> <itemtitle>JabberJabber</itemtitle...