xslt

XSLTT IF on tag titles

Hello, everyone I'm working on a XSLT file and I've hit a snag. I have a case where one tag can have two different subtags. Example: <TAG> <PERSON1/> <TAG> and <TAG> <PERSON2/> </TAG> Is there a way to write an XLS:IF statement on the tag to see if it's named "PERSON1" or "PERSON2", since PERSON1 and PERSON2 need to be handled i...

XSLT and repeating div question

Dimitre - great stuff! You nailed the xml schema and my expected result. I am using a xslt fragment to pull this information into the page. I am passing my pageIds into the xslt via the xslt fragment call. How can extend this code be able to process those passed in parameters in order to display the correct data from the xml? This is ...

Check if a variable of the for-each is equal with an XML entry

I'm trying to add the attribute 'selected' to <option>. I've tried various ways and I can't get it working. This is how I'm trying it: <xsl:for-each select="page/index/values/albums"> <option> <xsl:attribute name="value"><xsl:value-of select="id" /></xsl:attribute> <xsl:if test="page/index/values/album = id"> ...

How to load XML (with xslt) generated by javascript into an IFRAME?

I'm generating some simple XML via javascript, and then using doc.open, doc.write, and doc.close to write the xml into an iframe. My problem is that in the iframe, it is not being rendered properly. It's as if the xslt renderer is not kicking into gear and it tries to render as html(just showing the text node values). The xml itself is...

Select Attribute of XML Node within a Namespace with XSL

I have the following XML and I am trying to get a reference to the media:thumbnail and media:content URL attributes using the value-of statement in the XSL. I am able to get the title, link, description, etc, but not the media nodes and their attributes (url, width, height for thumbnail and url, medium, type, width, and height for group)...

How to break a for-each loop when value is set to prevent a double evaluation?

UPDATE: Improved the explanation so hopefully the problem is clear now :) Hi all! I've got a XML in which transitions of a FSM are declared (and events and states offcourse). Here's a simplified version of the XML which also causes the problem which is described below: <?xml version="1.0" encoding="UTF-8"?> <FSM name="MediaPlayer"> ...

How can I replace certain characters with their escaped variants using XSLT?

I'm trying to develop an XSLT stylesheet which transforms a given DocBook document to a file which can be fed to the lout document formatting system (which then generates PostScript output). Doing so requires that I replace a few characters in the text of DocBook elements because they have a special meaning to lout. In particular, the c...

Use HtmlAgilityPack to divy up a document

I'm wondering if this is possible. I have html like so: <p> <font face="Georgia"> <b>History</b><br>&nbsp; <br>Two of the polysaccharides used in the manufacture of...</font> <a title="PubMed" href="http://www.www.gov/pubmed/" target="_blank"> <font face="Georgia">) and this web site for new development by...well as Self ...

Efficient XSLT pipeline, with params, in Java

Hi, The top answer to this question describes a technique to implement an efficient XSLT pipeline in Java: http://stackoverflow.com/questions/1312406/efficient-xslt-pipeline-in-java-or-redirecting-results-to-sources Unfortunately, while Transformer seems to expose an API for setting XSLT parameters, this does not seem to have any eff...

xsl:cdata elements inside xsl:element

I am trying to get the following output : <name><![CDATA[ SomeNameHere ]]></name> using the following xslt : <xsl:element name="name"> <xsl:cdata> <xsl:value-of select="name"/> </xsl:cdata> </xsl:element> But while compiling I get the following exception : 'xsl:cdata' cannot be a child...

XSLT 1.0: grouping and removing duplicate

Hi, I have a xml grouping challenge for which I need to group AND remove duplicate as below: <Person> <name>John</name> <date>June12</date> <workTime taskID=1>34</workTime> <workTime taskID=1>35</workTime> <workTime taskID=2>12</workTime> </Person> <Person> <name>John</name> <date>June13</date> <workTime taskID=1>21</workTime> <workTime...

complicated references on xslt

I have the source document: <?xml version="1.0" encoding="UTF-8" ?> <tourcompany id="CMP001" name= "pacific cmp"> <country id="FRA" name="France"> <citylist id="list001" name="CityofFRA"> <city id="CT001" name="Paris"> <destination>PD1</destination> <destination>PD2</destination> <destination>PD3</destination> <destination>P...

How to use fn:replace(string,pattern,replace) in XSLT

How to use fn:replace(string,pattern,replace) in XSLT is it like < fn:replace(...)/>?? ...

How do I declare a parameter/variable inside a template using fronend-xslt

I call a template like this: <xsl:call-template name="trip_form"> <xsl:with-param name="header" select="'Spara din resa'" /> <xsl:with-param name="size" select="'savetrip'" /> </xsl:call-template> The templte looks like this: <xsl:template name="trip_form"> <xsl:param name="type" /> <xsl:param name="size" /> <xsl:param ...

Xslt - iterate nodes in chunks

I have an existing xslt script which creates a PDF with FOP, problem is that its running out of memory when doing apply-template on a specific nodetype when the node count exceeds a certain limit. In order to fix the memory issue I need to break up the result derived from that template call into several <fo:page-sequence>, but I dont wan...

using xslt and XMLfor generating the desired HTML

Hi Guys, I am using XSLT and XML so that it will generate my desired HTML. I am having two XMLS, below are the details. 1) Destinations.XML <?xml version="1.0"?> <list type="Destinations"> <resources location="include/xml/locations.xml"> <publication>481</publication> </resources> <destination id="594051" title="Sydney" url="/asiapac...

Netbeans 6.9 + XSL autocomplete

Theres some way to do Netbeans 6.9.1 autocomplete XSL tags? ...

Embedding XSL code inside an <a> tag

Hi I have some XML data which includes URIs. I want to list the URIs on an ASP page, but also to make them clickable using <a> tags. However XSLT does not allow you to embed an XSL command within a tag, eg: <xsl:for-each select="//uri"> <tr> <td class="tdDetail"> More information </td> <td> <a href="<xsl:value...

trouble with xml transformation

Hi, I have an xml that looks something like this <para> text text text <b>text</b> text text <i>text</i> </para> the objective is to convert this to mediaWiki formatting with ''' for a bold font and so on. when I write a transformation for this the template match ignores all the text inside the <para> tag and only the the <b>s ...

Using escaped HTML tags in XML documents as HTML code after XSLT transformation

I have xml files with escaped HTML code in them, and I want to use this as real html tags in the html output after an XSLT transformation. Some example XML may look like this: <root_node> <html_node> First line&lt;br&gt; Second line </html_node> </root_node> And an XSLT stylesheet could look like this: <xsl:stylesheet> ...