xslt

XSL, using XML as parameter to template

Is it OK to pass XML to an XSL template through a parameter? For example, below I have the template body call template test1 which passes some XML through the parameter var1. I then attempt to walk to the node a using XPATH <xsl:template name="test1"> <xsl:param name="var1" /> <fo:block> <xsl:value-of select="$var1/a" /...

XSLT: How to get a list of all used namespaces

I'm writing an XSLT 1.0 stylesheet to transform multi-namespace XML documents to HTML. At some place in the result HTML I want to list all the namespaces, that occured in the document. Is this possibile? I thought about something like <xsl:for-each select="//*|//@*"> <xsl:value-of select="namespace-uri(.)" /> </xsl:for-each> but o...

XSLT help in declaring namespace

Hi all, need some help in resolving the following issue. I need to transform the below input(XML) to the mentioned output(XML). <Header> <End_Date xsi:nil="true"/> <Header> To the following format. <Header> <End_Date xsi:nil="true" xmlns:xsi"http://www.w3.org/2001/XMLSchema"/&gt; <Header> This is the styles...

XSL Transform group By

I'm trying to group my results by a preceding node where this node contains the MasterCard or Visa. As you can see form the html generated, there are 3 sub-schemes for mastercard and visa. I want to group the html by the parent scheme mastercard and visa only which will display 2 card schemes. Any help on this would be greatly appreciate...

Oracle XSLT: default namespace results in empty tags

I think the best way to ask this question is: How do I specify a default namespace for the root element in the output? Doing this: <xsl:template match="/"> <r xmlns:s"http://www.mycompany.com/s/schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.mycompany.com/default/schema" > .... .... Gives me an ...

How to refer a variable within XSL from one function to another function?

I have 2 pieces of code in my XSL file. 1) <xsl:call-template name="Info"> <xsl:with-param name="parententry" select="a:feed/a:entry/@href" /> </xsl:call-template> 2) <xsl:template name="Info"> <xsl:param name="parentEntry" /> <xsl:variable name="parententryauthorname"> <xsl:value-of select="a:author/a:n...

How to limit line length for email XSLT

Hello, I'm trying to create a report in an email and email daemons chop lines if they're over ~ 2040 characters long. I'm using XSLT to build the email report and I need to break up these lines but I still need the link to work. <xsl:variable name="encoded_url"> <xsl:value-of select="saxon:string-to-base64Binary(concat(PROTOCOL,'://',...

XSLT format-number with comma

Hi, I'm trying to format this and other elements alike, so it would look like this 2,590: <Add_Amount>2,59</Add_Amount> Doing it like this: <xsl:decimal-format name="dkk" decimal-separator="," grouping-separator="."/> .... <xsl:value-of select="translate(format-number(Add_Amount, '#.###,000', 'dkk'), ',', '.')" /> And the ou...

Merge keys in two different XML files (separation of data from language)

I have two XML files to render one page in XSLT. This is because I have to separate the language from the data for a multilingual website. I need to relationate data from one and other to print a value. My index.xml: <?xml version="1.0" encoding="utf-8"?> <index> <language>en</language> <example> <category id="1"> ...

Ruby error on non-ruby site

A friends of mine have a shared hosting with many sites hosted. There is ruby on rails, php, xslt/xml sites using mysql or postgress. Today one of the xslt sites displays this error: Passenger error #2 An error occurred while trying to access '..../config/environment.rb': Cannot stat '..../config/environment.rb': Permission denied (13) ...

Generating XSL from XML

Can I create an XSL file from existing XML file? From comments: My requirement is as follows: I have an existing xsl file which transforms XML1 to XML2. The XSL is created by a college of mine and the resource no more available. I have source and I know how the target should look like. But I do not know how to XSL. Hence...

xslt - Need the largest value in an element set, not including default (99999999)

Hi... given the simple xml snipet... <workers> <worker> <name>Fred</name> <dob>19410501</dob> </worker> <worker> <name>Fred</name> <dob>19410501</dob> </worker> <worker> <name>Mary</name> <dob>99999999</dob> </worker> <worker> <name>Sam</name> <dob>19361202</dob> </worker> </workers> I n...

pass Node to Xerces' setParameter()

Hi all, I try pass a node as xsl stylesheet parameter to Xerces XSL Transformer transformer.setParameter("settings", nodeSettings); in xsl: But i receive the following Exception: javax.xml.transform.TransformerException: java.lang.RuntimeException: Invalid conversion of 'com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl'...

xsl unwanted next element - read attributes from tag and sub tag

I got really close this time ;) Bellow there is : my xsl script my xml file (that calls the script) the output of the manipulation of the xsl on the xml (as shuold be) My problem is that while the href and src value should be the same there is always one picture diff between them(pic3 and pic4) as though I'm calling the next pic el...

XSLT is duplicating a Description when I recurse XML

Hi All, I am using XSLT to recurse some XML and then apply some HTML to the output. It will recurse the data, but it duplicates the parent item description and I am not sure why? I am sure it is right in front of my face, but I don't see it. It is inserting right after the <ul> tag when it goes to the next level in the XML. XML Example...

how to access root attribute from deeper level in xslt

I'm calling a template: <table> <xsl:apply-templates select="data/pics/row"/> </table> the template is <xsl:template match="row"> <tr> <xsl:for-each select="td"> <td border="0"> <a href="{@referencddePage}"> <img src="{pic/@src}" width="{pic/@width}" height="...

XSLT problem during transformation

<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" version="1.0" xmlns:ms="urn:schemas-microsoft-com:xslt" xmlns:infoRequest="ControlSkin3" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="xmlns"> <xsl:output omit-xml-declaration="yes" method="xml" encoding="utf-8" /> I've got...

XSLT stylesheet: merging elements into one

What is an XSLT 2.0 stylesheet that will transform <paramList> <param name="y" out="true"/> <param name="y" in="true"/> <param name="z" out="true"/> <param name="x" in="true"/> </paramList> into <paramList> <param name="x" in="true" /> <param name="y" in="true" out="true"/> <param name="z" out="true"/> </p...

XML in SQL Server 2005

All, I am inserting as xml datatype in a table, an XSLT document. Somewhere in my XSLT document I am using the character &#60; for a reason. However when inserting to the table, the SQL Server replaces the &#60; with &lt; Any ideas how to store it without having SQL Server to change it? Thanks, M ...

XSLT Escaping Characters

I have the following fragment in XSLT. Is there a way to rewrite it without escaping the characters < and > with the ASCII equivalent? <coord> ... <xsl:with-param name="substringIn" select="'' ''"/> <xsl:with-param name="substringOut" select="'&#60;/coord&#62;&#60;coord&#62;'" /> ... </coord> I have a string of space delimited...