xslt

Including an XSLT file into an executable

Hello, I'm trying to build an executable which applies XSLT transforms onto a large number XML files. Now my problem is that I'd like to include/refer to the XSLT file stored with my C# VS 2010 solution, so that when I repackage this for another machine, I don't have to copy across the XSLT files. Is this possible? string xslFile = "C...

How to create a XML with a Specific Encoding using XSLT and XMLWRITER

I am trying to apply a XSL style sheet on a source xml and write the output to a target xml file. The xsl removes the xml comments present inside the source xml. The target xml file has UTF-16 encoding in the header. But still i want the output xml to be utf-8 encoding. The code i used is XmlWriterSettings xwrSettings = ...

XSLT Transforming performance

Here is links to my files XML XSLT Include XSLT Hi I am transforming xml into html. My xml file is about 10kb big and my xslt 70kb and output html about 10kb big. Transformer xformer = StylesheetCache.newTransformer(templateFile); xformer.transform(new DOMSource(outlineDoc),new StreamResult(out)); The creating of ...

xslt efficient selector usage

Hi, One of xslt stylesheets i have created has many usages of for example <xsl:template match="ProductType"> <xsl:value-of select="../../Title"/> </xsl:template> so my question is would it be more efficient to create a new nodeset manualy including just the data required or perhaps passing in using params? What would constitute bes...

How to use parameter as index in XSLT

Hi, I have a recursive template so that I can update a count. In the template, I want to be able to use the current count to be able to access the node whose index is the current count. <!-- in the template --> <xsl:param name="i"/> <xsl:param name="count"/> <NewNode> <xsl:value-of select="//ACommonElementInTheDocument[$i...

How do I transform a child element o uppercase if a child element with the same name exists?

I have an XML file that looks like this: .. <PersonalInfo> <LastName>Smith</LastName> ... </PersonalInfo> <DependentInfo> <LastName>Johnson</LastName> ... </DependentInfo> ... and I need to convert the last name of the dependent to upper case. I wrote this XSLT <xsl:value-of select="translate(//LastName, $smallcase, $...

Speed / Thread Safety / Queuing in XSLTCompiled transform

Hi, I'm pulling my hair out (what remains), with performance issues with XSLTCompiledTransform in our live environments. Locally on developer machines and UAT the problem is slightly noticeable, however in the live environment performance can become agonisingly slow. Background: HTTPModule delivering the website (processModel extend...

How to chain/nest XSL Transforms in .NET

Context: .NET Framework 3.5 I realize how I can perform a single XML transformation using XSLT, but didn't find any good examples on chaining XML transformations. Input: - XML document as XPathDocument. - File paths to multiple XSL files. Expected output: - preferably XPathDocument/IXPathNavigable, representing the XML with all transf...

XSLT Error: A semi colon character was expected

I've got this url that I need to place in a link in some XSL. Not sure where the problem is. If I pull the link out of the XSL it works fine. a href="https://xxxxx.com/sites/mcpharm/ApplicantDocuments/Forms/ApplicantUpload.aspx?List=%7B3D4B5CEF%AF61%2DBFA1945747EA%7D&amp;RootFolder=%2Fsites%2Fmcpharm%2FApplicantDocuments%2F{$QSApplicant...

Reverse-Engineering unknown XML based on known XSL

Solved! After following Matti's suggestions, I removed the custom functions and all is well. Original Post: I'm new to XSLT as of today, so I'm sure this is a no-brainer for many of you. Anyways: I've been tasked with creating a widget for my company's website that uses data provided by a 3rd-party vendor. The vendor refuses to send...

XSLT: convert carriage returns to paragraphs in mixed node while preserving HTML

I'm trying to wrap new lines in paragraphs without eliminating the HTML in the mixed node. I can get one or the other to work, but not both. XML: <root> <mixed html="true"> line 1 <a href="http://google.com"&gt;line 2</a> <em>line 3</em> </mixed> </root> desired output: <div> <p>line 1</p> ...

padding value using xslt

I have a value as 233. My requirement is to append '0' to the end of the value , so that total length will be 11 always. For example 233 -> should be 23300000000 [total length 11] 56789 -> should be 56789000000 [total length 11] Is this can be done in xslt ? My question is how can we add '0' to the end of the value using ...

way to convert word documnet to xsl-fo

I am using ms word 2007 , I would like to convert the word to xsl-fo ,there are some hints in the net but they do so only for renderx.Is there a tool for apache-fop ? ...

Is it possible to keep a count in a for-each loop in xslt

I need to keep a count of items that match a condition while looping through a node list using a for-each. I was using position() but this is incorrect as I need to keep a running total. Any help would be really appreciated. ...

How do i pass a full directory of XML files into XSLT

The following XSLT is transforming file1.xml and file2.xml. How do i replace those 2 files with a full folder listing of all the XML files? I am using VBA in Microsoft Access, and this stylesheet solves the problem of merging multiple files (credit to Alejandro) without dropping any newer fields as was the case during XML import. It ...

XSLT: call-template vs mode for execution flow

Which is better practice to use for execution flow, call-template or modes? data.xml <Properties> <foo>me</foo> <bar>you</bar> </Properties> a.xsl <xsl:include href="translations_nomodes.xml" <xsl:template match="/"> <xsl:call-template name="a_display"/> </xsl:template> b.xsl <xsl:include href="translations_nomodes.x...

Split large table into several smaller tables

I have a problem where a table has 100s of rows. It causes an issue and needs to be split into several smaller tables with fewer rows each. My html is valid xml as well. How can I split the table every x rows into a new table? And, how can I copy the table style, and first row (header) into each subsequent table. So something like t...

Saving an XSLT template in a Commerce Server 2009 Web Part

When editing a Commerce Server Product detail web part we are having a great deal of difficulty making changes to the XSLT template. These are not complex changes, just small minor changes. There is no problem with the template as I have tried it out on the w3schools XSLT editor and it works fine. I paste the template text in the dialog...

How to detect a leading space in the text.

I want to add some strings in the text right after a leading space. Any ideas how to detect the leading space? Thanks. For example, I would like to add "def" in front of abc but after the leading space. <AAA> <CCC> abc</CCC> </AAA> Output should become: " defabc" ...

change xml format with xsl or other

can i use xsl or another thing similar to change this format <rr n="Address"> <tt> <j n="currentAddress">0</j> <j n="city">city</j> </tt> </rr> to this :- <Address> <tt> <currentAddress>0</currentAddress> <city>city</city> </tt> <Address> notice that i want the attribute value to become the element and r...