File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes XSL transformation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XSL transformation" Watch "XSL transformation" New topic

XSL transformation

Jeppe Sommer
Ranch Hand

Joined: Jan 07, 2004
Posts: 270

I am trying to make a XSL transformation. I already have a XSL that works fine on my XML file, but I needed to change the XML file with a new root element and then I´m unable to make it work.

The old XML file looks like this:

The old XSL looks like this:

The NEW XML file looks like this:

The NEW XSL file which doesn't work looks like this:

In the new XSL I need a <xsl:for-each statement for each Invoice element, but I have problems to identify the Invoice element, possibly because of the template below:
><xsl:template match="udk:Invoice| pip:Invoice | pie:Invoice | pcm:Invoice |tpcm:Invoice |tpcp:Invoice|tpie:Invoice|tpip:Invoice | pcp:Invoice ">

Any help would be appreciated.

Thanks in advance.
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

Not even correct XSLT. The <xsl:template> elements must be top-level elements. Nesting them isn't allowed.

I would just take your old transformation and add this new template into it:

That matches the Root element and recursively tries to find and apply templates which match its children. You already have a template that matches the various Invoice elements, I believe.
Jeppe Sommer
Ranch Hand

Joined: Jan 07, 2004
Posts: 270
Thanks again. I appreciate your help
I agree. Here's the link:
subject: XSL transformation
It's not a secret anymore!