xslt

XSL Strip Padding

Is there a simple way to strip padding, IE leading and/or trailing white space. EXSLT padding function seems to only create padding or trim strings to a certain length. ...

copy node attributes to parent node

Im working with PHP5, and I need to transform XML in the following form: <section> <heading> <line absolutePage="4" page="2" num="35">A Heading</line> </heading> <subsection type="type1"> <heading label="3"> <line absolutePage="4" page="2" num="36">A Subheading</line> ...

Take count of unique values within distinct codes (XSLT 1)

Hi all, Stuck a bit with the following and would love some ideas/pointers in the right direction. I have the following XML: <RecordsCollection> <CustomerRecord> <customerId>12345</customerId> <currency>USD</currency> </CustomerRecord> <CustomerRecord> <customerId>12345</customerId> <currency>USD</currency> </Cus...

JUnit Report single page XSLT for email

I have a Junit process that runs a bunch of data integrity tests every night, and I would like to have it email the results in a nicely formatted HTML email. The issue is the HTML formatter built into JUnit uses frames and an external stylesheet so it is not appropriate for email. The plain formatter has the results buried in the midst...

How to select the grandparent of a node using xslt

I'm in a situation where I can only test for the child node, but I have to apply tags to the grandparent of this child node. I've tried using: <xsl:call-template name="grandparent" select="parent::parent::node()"/> and: <xsl:call-template name="grandparent" select="ancestor::node [@nameofgrandparentnode]"/> But neither works. Th...

Xslt1.0: passing a node paramter rom a template to another template

I am trying to pass a node as a parameter from a named template to another named template but it doesn't work. It works in the first one, but not in the second level call. It complains about trying to convert from java.lang.String to node-set. I am using xslt1.0. Any ideas? Thanks <xsl:template match="whatever"> <xsl:call-templat...

Aligning an element to the right using XSL-FO, Apache FOP

Hi, I'm using XSL-FO with Apache FOP to take a sexy looking XML file and output it as a PDF, however I'm having a really basic problem trying to get a particular bit of information (the address) to be positioned from the right of the page, I can force it over to the right by increasing the left attribute, but if I change my page size, or...

WYSIWYG XML Editor (DTD or RelaxNG or XSD based grammars)

Hi all I'm in need to make a WYSIWYG XML editor for a custom XML grammar. By this time I have explored all the OpenSource tools that I could find under this domain. Includes VEX, Oxygen, Bitflux... Since none of them were serving my purpose. I'm also looking for javascript based WYSIWYG HTML editors which can support and additional DOC...

xsl foreach loop not working on xml

I've been trying to iterate through an XML file using XSL , however I'm having major troubles as the only first language is being recognised. Help! <?xml version="1.0"?> <languages count="1"> <language>English (UK)</language> <language>Spanish</language> <language>Arabic</language> </languages> <xsl:stylesheet xmlns:xsl="http://...

Apply XSLT Transform to an already transformed XML

All, I have an XML file which I transform it using an XSLT document to another XML. Can I define another set of transformations in the same XSLT file to be applied in the result XML of the first transformation? Thanks, MK ...

Utilizing variables in xslt

I am inserting two variables countryVar and langVar into a node in my xml document. <link><![CDATA[/<% = countryVar %>/<% = langVar %>/products/index.aspx]]></link> I am utilizing the link node in a xslt like this. <a href="{link}"><xsl:value-of select="linkName"/></a> The value of link prints out exactly like it is in the xml docu...

Include language files (as XML) on a XSLT

I doing the right transformations to develop a multilingual website. All the text of this website needs to be taken from an XML file because the output of the site will be the processed file. This are the basic files, index.xml: <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="xsl/index.xsl"?> <page> <...

xslt: create new node from mixed content within parent element

Hi, I'm trying to write a template that will grab a mixture of text nodes and elements within a parent element and create a new node. I've done a lot of searching and couldn't find what I was looking for...so hopefully I'm not asking to basic a question. Here is a sample of xml I want to transform: <?xml version="1.0"?> <root> <para>...

XML/XSL: Sum in foreach loop with conditional (special case)

I have the following XML: <root> <groups> <group id="101"> <number>10</number> <children> <leader id = "A" /> <members> <member id="1"> <member id="2"> <member id="3"> </members> </children> </group> <group id="102"> <number>20</number> <children> <leader id = "A" /> <members>...

Merge 2 XML files, merge keys and apply it as a template

I have to files XML files: language.xml and menu.xml. The first one is loaded by default, the second is loaded with <xsl:param />. language.xml: <?xml version="1.0" encoding="utf-8"?> <language> <header> <menu> <title>Title of example</title> </menu> <menu> <title>Title of example 2</...

XSL removing empty nodes within the same code

Hi there, I've created the following XSL stylesheet which takes an XML packet ( given to me from SVN ) and converts all the "entry" nodes, which don't include the text "archive", into a comma-separated list for my ANT script. An example XML file looks like this.... <?xml version="1.0"?> <lists> <list path="https://mydomain.com/branches...

xslt pattern match transformation

How can I transform the following XML with XSLT from this: <root> <list> <item label="21(1)">some text</item> <item label="(2)">some text</item> </list> <list> <item label="a">some text</item> <item label="b">some text</item> </list> </root> to this: <root> <list label="21"> ...

xslt select grandparent node depending on an attribute value of its grandchild node

I'm trying to add different tags to a node depending on an attribute value of its grandchild node. Sample Input (a 1x3 table): <table> <row> <cell row="1" column="1" >heading text one</cell> </row> <row> <cell row="2" column="1" >body text one</cell> </row> <row> <cell row="3" column="1" >bo...

What are XSLT Result Trees

I am reading a book on XSLT 2.0. I am on the chapter of XSLT Result Trees. Frankly, i don't understand it a bit. What are result trees? What is it used for? Why is it important? ...

XML/XSLT/Access/VBA: how can i merge all child elements (even unknown elements) into one, before importing to Access database?

CURRENT XML: <?xml version="1.0"?> <form1> <page1> <first_name></first_name> <last_name></last_name> . . </page1> <page2> <address></address> <phone_number></phone_number> . . </page2> <page3> <company_name></company_name> <job_title></job_title> . ....