xslt

Need instream-foreign-object and text to both align to the bottom in XSL-FO

I have an XSL-FO stylesheet that is used for generating a barcode with a piece of description text immediately after it. When I run it through the Ibex FO application, the text properly lines up with the bottom of the barcode. When I run it through Apache FOP (it's an older version 0.3x... I CAN'T change this), the text lines up with t...

XSLT Transform of Unicode source

In my application I am using the 4Suite.org XSLT library to perform transformations of source XML. The syntax is like this: from Ft.Xml.Xslt import Transform transformed_xml = Transform(raw_xml, stylesheet) where raw_xml and stylesheet have been defined elsewhere in my application. raw_xml will be the xml resulting from reading a fi...

XSLT: Add text inside html tag

Is it possible to add text from a xsl variable to the inside of a html tag something like this? <xsl:variable name="selected"> <xsl:if test="@class = 'selected'"> class="selected"</xsl:if> </xsl:variable> <li{$selected}></li> ...

A interesting question about the xsl processing

I am using xsl to transform a xml to html. A table is created in the html but some problem of the unduplicated items appear. If I use a unique key to form the table(xsl for-each of every row), for example, context, but this attribute is not in the table. the final table is like this context(invisible) attr1 attr2 attr3 1 ...

switch case in XSL

I have a loop with the same tags to load content in ten cells but has a difference div title and background image, so I wonder is there any way to use the switch case just to put correct div title when I do for-each to load content for each cells in XSL? something like this: <...load the same tags content here...> Please help me be...

xslt test to see if a node is one of the first X children of its parent

I am editing an XSLT template and my skills are a little rusty. I would like to write a condition to see if the current node is in the first three child nodes of its parent. <parent> <child> <child> <child> <child> </parent> So the first three child elements above would return true, but the fourth would return false, to complicat...

XSLT: How do I trigger a template when there is no input file?

I'm creating a template which produces output based on a single string, passed via parameter, and does not use an input XML document. xsltproc seems to happily run with a single parameter specifying the stylesheet, but I don't see a way to trigger a template without an input file (no parameter to xsltproc to run a named template, for ex...

"Unrolling" a string with XSL

We have an application which has a heirarchical group structure. Some of the groups are passed in this format: /Geography/NA/US/California I would like to "unroll" this string so that I can get a node set like the following: /Geography /Geography/NA /Geography/NA/US /Geography/NA/US/California I know I can use str:tokenize and get ...

XSLT/XPath : No upper-case function in MSXML 4.0 ?

I try to use upper-case() in an XPATH, my parser is MSXML 4.0, and I get : upper-case is not a valid XSLT or XPath function. Is it really not implemented ? ...

XSL Template Node Navigation

Thank you one and all. I have an PHP MVC framework that uses XSLT for the templates. I have registered some php functions with the template to allow the use of modules in the template. This allows us to call modules at need be instead of running all the modules first regardless if you need them all. The problem is the fact some (most, ...

XSLT Insert element only if it doesn't exist

I have a source document: <?xml version="1.0"?> <source> <ItemNotSubstituted/> <ItemToBeSubstituted Id='MatchId' /> </source> And a stylesheet containing content I want to substitute into the source: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; <xsl:output indent="yes"...

Time-consuming XSLT without hanging the browser?

(N.B.: Yes, this is a ridiculous question, and I will be entirely unsurprised if the answer to this question is "no". That said:) I've written an XSLT stylesheet which deliberately performs a lengthy, unparallelizable computation on an XML fragment. It's intended as a component of a proof-of-work system to be used in a web browser as a ...

Store a group of nodes as a variable in XSLT?

So here is my current code: <xsl:variable name="address"> <xsl:value-of select="concat(/node1/node2/address.node/street, /node1/node2/address.node/city, /node1/node2/address.node/zip)" /> </xsl:variable> Now, I'm trying to shorten this down to: <xsl:variable name="addressNode"> <xsl:value-of select="/node1/node2/address.node"...

How to call named templates based on a variable?

I don't know if it's possible, but I'm wondering how to do it... Let's say we have the following XSL: <xsl:template name="foo"> Bla bla bla </xsl:template> ... <xsl:template name="bar"> Bla bla bla </xsl:template> ... <xsl:template match="/"> <xsl:if test="$templateName='foo'"> <xsl:call-template name="foo"/> </xsl:if> <x...

Loading xml from url without styling it in C#

I'm trying to load an xml from a url in C#, but the problem is that, there is an xsl attached to the xml file, which means that I don't get the content of the xml file, but the html that it's transformed to using the xsl. Is there any way to load the xml without first transforming it, so I just get the content of the xml? ...

XSL disable-output-escaping removes whitespaces

Part of the XML: <text><b>Title</b> <b>Happy</b></text> In my XSL I have: <xsl:value-of select="text" disable-output-escaping="yes" /> My output becomes **TitleHappy** My spacing went missing - there's supposed to be a space between </b> and <b>. I tried normalize-space(), it doesn't work. Any suggestions? Thanks! ...

XML to formatted text using XSLT

I have XML in the following format: <Order> <Customer> <Name>kapil</name> <AddressLine1>ABC</AddressLine1> <PostCode>12345</postCode> </Customer> <Customer> <Name>Soniya</name> <AddressLine1>XYZPER</AddressLine1> <PostCode>54321</postCode> </Customer> <Customer> <Name>kapil</name> <Addre...

Date time in xslt

Hi i am having the xml file as: <order><Extension Properties><Date>2009-08-04T17:09:04.593+05:30</Date></Extension Properties></Order> and i want the output as Generation Date 040809 I want to do this via xslt.Please help..!! ...

variables in xslt

hi friends I am getting a particular value by using <xsl:value-of select="@date" /> and i want to store this value as a variable say 'd' How can i do this and also tell me how can i use that caribale back in my template. Thanks in advance ...

Xml to text with formatting

Hi friends...I am having a lot of problem. I need the solution very urgent..please help me So i am having a xml file as: <Order> <EP> <Name>Generation Date</Name> <Value>2009-08-04+05:30</Value> </EP> <EP> <Name>NoOfRecords</Name> <Value>100</Value> </EP> <OrderLineItems> <OrderLineItem OrderDateTime="2007-01-01T17:0...