• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

How to pass string instead of xml in xsl

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

In my current project i have to combine different xml into one xml. so that i have used one xsl file. In this i have hard coded the xml file. But i want that file come as a string . how i can do this.


Code.

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"/>
<!-- load the merge file -->
<xsl:variable name="emps" select="document('employeeAddresses.xml')"/>
<xsl:template match="/">
<employees>
<xsl:for-each select="employees/employee">
<!-- cache the employee's ID -->
<xsl:variable name="id">
<xsl:value-of select="@id"/>
</xsl:variable>
<!-- copy the child nodes -->
<employee>
<xsl:copy-of select="child::*"/>
<!-- copy the children of the matching
employee node
from the merge file -->
<xsl:copy-of select="$emps/employees/employee[@id=$id]/child::*"/>
</employee>
</xsl:for-each>
</employees>
</xsl:template>
</xsl:stylesheet>



Thanks,

rizwan
 
Sheriff
Posts: 28346
97
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
Do you mean that you want the file name to be a variable instead of a constant?
 
Rizwan Qadri
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes
 
Would you like to try a free sample? Today we are featuring tiny ads:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic