xslt

Can I put control characters in XML via XSLT?

I have the following problem: I have an XML and an XSLT file to process this it and generate output. The output of this process should contain a control character '0B'. And as far as I know, XML doesn't embed control characters, so how can I accomplish this? ...

XSL - Does evaluating conditional expressions "shortcut"?

Given an XSL 'If' statement: <xsl:if test="a = 'some value' and b = 'another value'"> If a does not equal 'some value', is the value of b still checked? (As if the first test is false, the only outcome of the and is false.) This is what languages like C# do - I was wondering if the same goes in XSL. Does it depend on the engine/parser...

Reuse variable defined inside choose, outside of choose in XSLT

I have a piece of code that look similar to this: <xsl:choose> <xsl:when test="some_test"> <xsl:value-of select="Something" /> You are: <xsl:variable name="age">12</xsl:variable> years </xsl:when> </xsl:choose> My problem is that I would like to use the variable $age outside of the choose. How do I do ...

How to allow one jPOS ISOField to contain Control character?

I am using w3c dom object that represnet an XML file to create the jPOS ISOMessage object. (loop over the dom object ans set ISOMessage Fields) The Question is: In the resulting ISOMessage Object, How to allow one ISOField to contain Control character? Note: I am using a Custom Packager that reads the format of the ISOMessage from xml...

Can XSLT be used to form a plain txt file, not just html?

Lately I have become a huge fan of XSL, XPath and XML, but I've only used it to format outputted html documents, with a head and body sections. I was wondering if its possible to use good of XSLT to format other types of documents, like plain txt? ...

Modify an XML node using [MS] XSLT Script

I would like to select a node and modify its attributes and child-nodes using an xsl:script function. In addition, templates matching child-nodes of that node should STILL perform their job (after script is done processing the node). Can it be done using XSLT? Can you please provide an example / skeleton for such a transformation? ...

Sorting nodes in XLST

This code selects the nodes, I want to work on...: <xsl:variable name="rootTextpageNode" select="$currentPage/ancestor-or-self::node [@level = 2 and @nodeTypeAlias = 'CWS_Textpage']" /> How can I put a sort/orderby in there, so items with newer createdDate are displayed first? I'm using the CWS starter kit, and nee...

Complex XSLT split?

Hello, Is it possible to split a tag at lower to upper case boundaries i.e. for example, tag 'UserLicenseCode' should be converted to 'User License Code' so that the column headers look a little nicer. I've done something like this in the past using Perl's regular expressions, but XSLT is a whole new ball game for me. Any pointers in ...

XSLT - XML Value as CSS Class

I want to use data from XML to populate a class: E.g. <p class="<xsl:value-of select="a:Subject"/>">English</p> Which would generate: <p class="English">English</p> IS this possible? ...

with-param not working in apply-templates

I am currently trying to generate the creation SQL for my tables based off of a Visio diagram. I am doing this using the approach found here. http://www.dougboude.com/blog/1/2008/11/SQL-Forward-Engineering-with-Visio-2003-Professional.cfm I am attempting to modify the xslt file found there to better model the syntax that we use in our ...

How do I inline the contents of an external HTML document using XSLT?

I have an XSLT that I input to a 3rd party application. This application displays the result of that XSLT as a web page in their application. I have a dynamic HTML document that I want to display in that application. How can I "read" the HTML document via an XSLT document such that whenever the html document is updated, the XSLT will ...

How can you determine what Sharepoint WebPartZone you are in from an XSL file to dynamically output the style?

I have a page with 5 Sharepoint web part zones and an XML web part that can go in any of them. One of them needs different styling than the other 4. Is it possible to have the XSL file determine what webzone the web part is in and style it appropriately? ...

How to Rename xml elements and use the new names in the same XSL styleSheet?

I have a xsl file for html output. the xsl handles an old format of xml whixh I want to renew now. Therefore I need to rename the old elements names to the new names I'm using the new names in the following xsl code. How can I do this? I tried <xsl:template match="OldName"> <NewName><xsl:value-of select="."/></NewName> </xsl:template> <...

xsl : getting specific node values from a table

My XML Code <DBE:Attribute name="Test1" type="Table"> <DBE:Table> <DBE:TableHeader> <DBE:TableColumn>t1</DBE:TableColumn> <DBE:TableColumn>t2</DBE:TableColumn> <DBE:TableColumn>t3</DBE:TableColumn> <DBE:TableColumn>t4</DBE:TableColumn> <DBE:TableColumn>t5</DBE:T...

Convert locale to language/country using XSL

I need to figure out the best way to convert locale strings to a human-friendly name. I could write a large <xsl:choose> and just add a condition for each of the locales I want to convert, but I think there is probably a more efficient or clever way. My input looks like this: <content name="locale" value="en_US" /> <content name="local...

Using xsl:include with AJAX/XSLT

I am using Javascript to load XML and transform it with XSLT. Everything works until I try to use <xsl:include>. Is it possible to include files this way? Here is the relevant XSLT code. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; ... <xsl:include href="another_xslt.xsl"/> </xsl:stylesheet> And ...

Using XSL to sort attributes

I'm trying to canonicalize the representation of some XML data by sorting each element's attributes by name (not value). The idea is to keep textual differences minimal when attributes are added or removed and to prevent different editors from introducing equivalent variants. These XML files are under source control and developers are wa...

Localization approach for XSLT + RESX in ASP.NET

I have an ASP.NET web app where the back end data (XML format) is transformed using XSLT, producing XHTML which is output into the page. Simplified code: XmlDocument xmlDoc = MyRepository.RetrieveXmlData(keyValue); XslCompiledTransform xsl = new XslCompiledTransform(); xsl.Load(pathToXsl, XsltSettings.TrustedXslt, null); StringWriter s...

Passing a URL in a XML file for XSLTransformation in C#

My XSL file contains a line like this. Click <a href="<xsl:value-of select=""/ROOT/QUERYSTRING""/>"> here </a> to continue... The value "/ROOT/QUERYSTRING" is populated from a XML which would be any arbitrary URL. But when I run the transformation, it's throwing an XSLT Compile Error at the line, href = "<xsl stating, "< is unexpected...

Two xml in one xslt

Hi can i do this in a xslt , and if yes then how..? I have one xml file which contains one element called 'reasonCode' , this reason code is mapped to different 'reasonText' in another xml.What i hae to do is check the 'reasonCode' from first xml and select the corresponding 'reasonText' from second xml.Can i do this using XSLT...if yes ...