• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XML Transformation

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new to ranch and I apologize if I am not posting this topic in the right thread.

I have been looking at this for sometime now and need your help. My problem is why is data being output outside the xml elements too. I am attaching the source, xsl and output....Sorry couldn't attach, so pasting. Please let me know if you need something else

ranch_source.xml




ranch_PTF.xsl



out.xml
 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'll move this thread to our XML forum.
 
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Monika Sa wrote:My problem is why is data being output outside the xml elements too.



Chances are, that's because they are being output by one of the built-in template rules. I only see a named template in what you posted and I don't see anything which would call it,
so it's pretty likely that everything you see in your output came from the built-in template.
 
Ranch Hand
Posts: 734
7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Automatic xslt generation is a double-edged swore. It can backfire terribly at times if you don't know many contingent factors in play that might need user-intervention. That software can put up parameter with dreadful select="/.." that I would never, for instance. But that is not the problem, they can do that if it amuses them.

This is the problem. In all your (named) templates, where-ever there appears this block:

<xsl:for-each select="$input/node()">
<xsl:if test="not(self::text())">
<xsl:if test="not(self::*)">
<xsl:value-of select="."></xsl:value-of>
</xsl:if>
</xsl:if>


Replace the block by this line.

That would make xalan well-behaved. The necessity of it is in fact processor-dependent, too bad.

Edit note: code block seems having problem in display for this moment?!
 
reply
    Bookmark Topic Watch Topic
  • New Topic