xslt

XSLT2 format-dateTime - AM/PM without dots/periods

Hi, This is a question for XSLT 2 format-dateTime function. Please can anyone tell me how to make A.M./P.M. display with not dots/periods (AM/PM)? <xsl:variable name="ampm" select="format-dateTime(DATE, '[PN]')"/> The below code returns blank? <xsl:value-of select="replace($ampm,'.','')"/> Thanks, Will ...

Translate XSL files with PHP and gettext

Is it possible to translate XSL files using PHP and gettext? I'm building a web application where most of the user interface code is in XSL files. I'm using PHP gettext to translate PHP pages and an app called Poedit to translate the texts. All this works very well! I would need a way to translate the XSL files too, preferably so that P...

Adding localization to XSLT

I'm using an XSL file to do the rendering of an ASP.NET webpart that I made, but now I want to localize the strings inside that XSL file: <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:siteInfo="urn:siteInfo" version="1.0"> <xsl:output method="html" omit-xml-declaration="no"/> <xsl:template match="*|/"> <p...

Reduce repeating expression in XSLT 1.0

Hi everyone, I have the following XML (simplification): <?xml version="1.0" encoding="utf-8"?> <TestCases> <TestCase> <Name>Test1</Name> <Result>Failed</Result> <Properties> <Type>Type1</Type> </Properties> </TestCase> <TestCase> <Name>Test1</Name> <Result>Failed</Result> <Properties> <Type...

Error with XSL validation of Javascript

Hello, I am getting validation errors such as: "No processing instruction starts with 'xml...." when I try to validate my code before I put it into the 3rd party app I'm using. How do I send a soap message with Javasript that is embedded on an XSL page without getting this error ? Here is the code in question: <script language="javascr...

XSLT 1.1 nodeset

I have this... <xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exslt="http://exslt.org/common"&gt; <xsl:variable name="data"> <root> <test>1000</test> <test>2000</test> <test>3000</test> </root> </xsl:variable> <xsl:template match="/"> <xsl:for-each select...

How to Copy a Node from XML without copying a child of that node using XSLT?

I have a huge XML that i need to work on, but i only need a node of the several in the root. The problem is that, in that node, i got one child that need to be remove. Anyone care to explain if this is possible and, if it is, how can be done? This is a sample of the XML that i got: <XML> <Properties> Contend </Properties> <Eve...

preceding-sibling with a twist

In the sample XML there are two forms that match on number and type; in the second matching form I need to blank out the flag element's value. I cannot change the level I am iterating over due to some interrelated stylesheets. I can do preceding-sibling if I were iterating on formslist but I can't seem to get the syntax correct when I...

How do I configure Poedit to read XSL files

This is one line in my code: <xsl:value-of select="php:function('gettext','Hello world')" /> How do I get Poedit to automatically find the text string from the .xsl file? ...

xslt: substring-before

I have the folowing xml code: <weather-code>14 3</weather-code> <weather-code>12</weather-code> <weather-code>7 3 78</weather-code> Now i'd like to only grab the first number of each node to set a background image. So for each node i have the folowing xslt: <xsl:attribute name="style"> background-image:url('../icon_<xsl:value-of se...

XSLT transformation on Large XML files with C#

I have some very large XML files (800 MB to 1.5 GB). I need to apply XSLT on that. I am able to read it XMLTextReader. When i applied XSLT transformation, get SystemOutOfMemory Exception. My code looks like; static void Main(string[] args) { XDocument newTree = new XDocument(); XmlTextReader oReader = new XmlTex...

converting &#xD; into <br/> using XSL 1.0

Hi, Given XML of: <data> <field>Value 1&#xD;Value 2&#xD;Value 3&#xD;</field> </data> I would like to be able to create some HTML to display the values and convert the &#xD; into <br/> <html> <head/> <body> <div>Field Values</div> <div>Value 1<br/>Value 2<br/>Value 3<br/></div> </body> </html> However I can't think of way to do thi...

Summing values of recursive functions in XSLT

I have XML like this: <assessment name="Assessment"> <section name="Section1"> <item name="Item1-1"/> <item name="Item1-2"/> <item name="Item1-3"/> <item name="Item1-4"/> <item name="Item1-5"/> </section> <section name="Section2"> <item name="Item2-1"/> <item name="Item2-2"/> <item name="Item2-3"/> <sec...

I need an XSLT transformation that separates nodes based on a comparison between child nodes and that make a calculation as a result.

This is a bit complex and I really don't now if it is possible. I got this XML: <XML> <member> <InicialAmount>10000000</InitialAmount> <Flows> <Payment> <Date>20100621</Date> <Period> <Amount>10000000</Amount> <StartDate>20100521</StartDate> <EndDate...

grouping tests based on class in mstest report using xsl

I'm writing an xslt for the trx file of mstest. Apart from knowing the results of the entire session, I'd also like to know the number of successes and failures for each class. I've tried out many ways, but i'm not able to get the results for a particular class. This is how the xml looks. (edit) <TestRun> <ResultSummary outcome="...

Counting distinct items and parsing comma-delimited values using XSLT

Suppose I have XML like this: <child_metadata> <metadata> <attributes> <metadata_valuelist value="[SampleItem3]"/> </attributes> </metadata> <metadata> <attributes> <metadata_valuelist value="[SampleItem1]"/> </attributes> </metadata> <metadata> <attribu...

is square bracket valid in xsl tag

I want design something like... <DB[0]><xsl:value-of select="test"><DB[0]> which will update the database table field DB[0] with data test. But it's not working ...as xsl is not allowing [] bracket. ...

How to display attributes depending upon the attribute value using XSLT ?

Hi All, We are using XSLT to display xml attributes depending upon their value. We are able to do it from server side using C#. But we are not getting how to achieve it through XSLT. We are using sample xml as; <BookInfo> <BookTable show="Book 1" > <book id="book1" value="Book 1" /> <book id="book2" value="Book 2" /> ...

and and or condition in single xml statement

I want to construct a statement containing and and multiple or expressions in xml like <xsl:choose> <xsl:when test="VAR1 and VAR1/text() != 'A' | 'B' | 'C'"> <xsl:value-of select="$data"/> </xsl:when> <xsl:otherwise>0.0</xsl:otherwise> </xsl:choose> but its nt working... ...

XSLT: Process an Xml node set in a template while still having access to the document root

I have an xslt stylesheet that needs to call a C# XSLT extension function in order to process a collection of elements. The code looks a little like this: Xslt: <xsl:apply-templates mode="MyTemplate" select="myextension:GetSomeCollection(@someattribute)" /> <xsl:template mode="MyTemplate" match="myroot"> <xsl:value-of select="xpath"...