Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XSL transformation

 
Jeppe Sommer
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.

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
Sheriff
Pie
Posts: 20717
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 270
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks again. I appreciate your help
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic