xslt

XPath selection from path in XML content

I have the following XML: <root> <name>The name</name> <long> <path> <value>Some Value</value> </path> </long> <field>/root/name</field> <field>/root/long/path/value</field> </root> and I want to select these paths in the field tags however, when I try the following: <xsl:value-of select="/root/field[1]" /> ...

Email template using XSLT

HI all, I have an XML with the different email bodies. I am using xslt to prepare an email template for sending these emails. I also want to include <subject> tag to the xml so that the email is more maintainable.I am using spring to send mail. I need to set the body ans subject of the mail. Body of the mail i am setting by using xslt...

Linking to an item in another node (XSLT)

I have an XML document with companies listed in it. I want to create a link with XSLT that contains the <link> child of the next node. Sorry if this is confusing..here is some sample XML of what i'm trying to obtain: <portfolio> <company> <name>Dano Industries</name> <link>dano.xml</link> </company> <company> <name>Mike and Co.</nam...

Can the current date be inserted into output through XSLT v1.0

I have an incoming data stream that is being converted with XSLT v1.0 that incoming data does not contain any date information. what i would like, is a nice way of getting the current date to become part of the resulting output stream. I am aware of the 2.0 current-date() type functions - unfortunately those are not available to this en...

XSLT For Breaking Elements Into Sets?

Is XSLT a good solution for breaking an XML document into sets by element name? For example, if my document is: <mydocument> <items> <item>one</item> <item>two</item> <item>three</item> <item>four</item> </items> </mydocument> I want to split this into sets of 3 or less like: <mydocument> <items page="1"> <item>one</item> <item>two</...

Is there any way to get the combine two xml into one xml in Linux.

XML one is something like that: <dict> <key>2</key> <array> <string>A</string> <string>B</string> </array> <key>3</key> <array> <string>C</string> <string>D</string> <string>E</string> </array> </dict> XML Two is something like that: <dict> <key>A</key> <ar...

Separating positive values from 'zero' values in an XSLT for-each statement

I am traversing an XML file (that contains multiple tables) using XSLT. Part of the job of the page is to get the title of each table, and present that title with along with the number of items that table contains (i.e. "Problems (5)"). I am able to get the number of items, but I now need to separate the sections with 0 (zero) items in...

More XML Problems - Undeclared Entity 'nbsp'

I'm getting the error: Line 49: xml = r.ReadToEnd(); Line 50: Line 51: System.Xml.Linq.XDocument xmlDoc = System.Xml.Linq.XDocument.Parse(xml); Line 52: Line 53: var query = from p in xmlDoc.Descendants("member") On my XML. When I run the code to generate the XML in an empty page, it ...

XSLT Type Checking

Hi Folks Is it possible to check an elements ComplexType? i have this (simplified): complexType Record complexType Customer extension of Record complexType Person extension of Record <xsl:template match="/"> <records> <xsl:apply-templates /> </records> </xsl:template> <xsl:template match="!!! TYPECHECK FOR RECORD !!!" ...

XSL - How to tell if element is last in series

I have an XSL template that is called (below). What I would like to do is be able to tell if I am the last Unit being called. <xsl:template match="Unit[@DeviceType = 'Node']"> <!-- Am I the last Unit in this section of xml? --> <div class="unitchild"> Node: #<xsl:value-of select="@id"/> </div> </xsl:template> Ex...

How to process more that one XML document in XSLT?

Is there any trick to match two XML by one XSLT? I mean the way I can apply XSLT to a parameter passed. For example (I missed declarations to be short). XML1: XML to be transformed: <myData> <Collection> </Collection> </myData> XSLT need to be applied to the previous XML: <xsl:param name='items' /> <xsl:template match='Collec...

Using xsl param (if exists) to replcae attribute value

I would like an xsl that replaces the value attribute of the data elements only if the relevant param names are passed (they are passed from the calling java program). Input <applicationVariables applicationServer="tomcat"> <data name="HOST" value="localhost"/> <data name="PORT" value="8080"/> <data name="SIZE" value="10...

XSLT how to merge some lists of parameters

Hi, I have an URL Structure like this: http://my.domain.com/generated.xml?param1=foo&amp;param2=bar&amp;xsl=path/to/my.xsl The generated XML will be transformed using the given XSL Stylesheet. The two other parameters are integrated too like this: <root> <params> <param name="param1">foo</param> <param name="param2">bar</...

Problems with Xalan and Java JDK 1.5

From what I believe and have read online. Sun has decided to include Xalan in JDK 1.5. I am trying to take advantage of this and try to perform an XSLT to spit out multiple files. The problem I encounter: 'Unrecognized XSLTC extension 'org.apache.xalan.xslt.extensions.Redirect:write''" From what I have read on google that i needed to c...

Iteration, or copying in XSL, based on a count. How do I do it?

I'm trying to create an inventory list (tab-delimited text, for the output) from XML data. The catch is, I need to take the line that I created, and list it multiple times (iterate ???), based on a number found in the XML. So, from the XML below: <?xml version="1.0" encoding="UTF-8"?> <library> <aisle label="AA"> <row>bb</row> ...

XSL split string using empty elements

Let's say I have a line in an XML file like the following (derived from an HTML file): <i>This is a nice poem<br/>It doesn't rhyme<br/>because right now<br/>I don't have time</i> I am attempting to right an XSLT to split this string with the following output: <stanza> <line>This is a nice poem</line> <line>It doesn't rhyme</l...

Writing more efficient xquery code (avoiding redundant iteration)

Here's a simplified version of a problem I'm working on: I have a bunch of xml data that encodes information about people. Each person is uniquely identified by an 'id' attribute, but they may go by many names. For example, in one document, I might find <person id=1>Paul Mcartney</person> <person id=2>Ringo Starr</person> And in anoth...

XSLT compile error when using XslCompiledTransform.Load indirectly called from an application.

I have a component written in C#. Among other things it performs XSL transform on XML data it collects. When I test this feature using another C# project that uses the component it works just fine. However when I export the component as a COM component and try to use this feature from an application it fails on the XslCompiledTransform.L...

Sanitizing DB inputs with XSLT

Hello I've been looking for a method to strip my XML content of apostrophes (') since my DBMS is complaining of receiving those. I need <name> Jim O'Connor</name> to become: <name> Jim O''Connor</name> By looking at the example described here, that is supposed to replace ' with '', I constructed the following script: <xsl:s...

xsl - exclude <td> from <div>

is there any way to have a div around an entire table, but exclude one <td>? TIA ...