• 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

Query relating to transforming XML using XSL

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I am new to XSL & I have 2 doubts.
1>
I have a XML file & using a XSL file I have to extract a portion of input XML(say SuperXML) to get a new XML(say subXML).The XSL file has to read a properties or CSV file to fetch some IDs & for each ID picked XSL has to transfrom super XML to generate subXML.Question, XSL is reading 2 files,properties/CSV & SuperXML,how can I do this.Is it possible that XSL reads 2 input files.I hope I m not confusing you.
2>
Now,a simple one I have following skeleton of a XML file
<tag1>
..<tag2>
...<tag3>
...<catchme>first<catchme>
...<catchme>second<catchme>

& I want to get data from 2 <catchme> tags.I am using following in XSL but it is not getting data.Please advise where I m wrong.

Thanks in advance.
----------------------------------------------------------------------------

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl utput method="xml" encoding="ISO-8859-1" indent="yes" />

<!-- tag1 -->
<xsl:template match="/">
<tag1>
<xsl:apply-templates/>
</tag1>
</xsl:template>

<!-- tag2 -->
<xsl:template match="tag1/tag2">
<tag2>
<xsl:apply-templates select="tag3"/>
</tag2>
</xsl:template>

<!-- tag3 -->
<xsl:template match="tag1/tag2/tag3">
<tag3>
<xsl:for-each select="catchme">
<catchme><xsl:value-of select="catchme"/></catchme>
</xsl:for-each>
</tag3>
</xsl:template>
 
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rubal,
You can read the external xml files using document() function of xslt, check some xslt tutorials to learn the usage. www.w3schools.com tutorials were also good.
reply
    Bookmark Topic Watch Topic
  • New Topic