Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 24th, 2015, 11:39 AM
Registered User
 
Join Date: Dec 2015
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to use multiple xml files within one xslt

i have two xml file

userdata.xml

<Users>
<User_Detail>
<last_name>k</last_name>
<first_name>r</first_name>
<office_id>1</office_id>
<current_phone_number>9030044404</current_phone_number>
<title>Administrator</title>
</User_Detail>
<User_Detail>
<last_name>A. Fortman</last_name>
<first_name>k</first_name>
<office_id>1</office_id>
<current_phone_number>9701817788</current_phone_number>
<title>Deputy Administrator</title>
</User_Detail>

officeData.xml

<office>
<officeDataXML>
<Office_ID>5</Office_ID>
<Region_ID>MW</Region_ID>
<Office_Level>RO</Office_Level>
<National>1</National>
<Region>5</Region>
<Physical_Office_Name>Chicago Illinois RO</Physical_Office_Name>
</officeDataXML>

<officeDataXML>
<Office_ID>107</Office_ID>
<Region_ID>SW</Region_ID>
<Office_Level>DO</Office_Level>
<National>1</National>
<Region>6</Region>
<Physical_Office_Name>Texas DO</Physical_Office_Name>
</officeDataXML>

using javascript I am sending first name lastname as parameters in xslt but, result is show using userdata.xml

I am getting Office_ID value as number, using that number I want get Physical_Office_Name from OfficeData.xml

Can you please help me, MY xslt is like this

<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="lname" select="null"/>
<xsl:param name="fname" select="null"/>


<xsl:template match="/">
<table class="stripeMe" width="700" cellpadding="5" cellspacing="1">

<thead>
<tr>
<td>Employee Name</td>
<td>Position</td>
<td>Office</td>
<td>CALL US Extension</td>
<td>Direct Line</td>
</tr>
</thead>
<xsl:for-each select="Users/User_Detail">
<xsl:sort select="title" order="ascending" />
<xsl:sort select="last_name" order="ascending" />
<xsl:choose>
<xsl:when test="$lname!='' and $fname !=''">

<xsl:if test="last_name=$lname and first_name=$fname">
<tr>
<td>
<strong>
<xsl:value-of select="first_name"/> <xsl:value-of select="last_name"/>
</strong>
</td>
<td>
<xsl:value-of select="title"/>
</td>
<td>
<xsl:value-of select="office_id"/>
</td>
<td>
<xsl:value-of select="new_extension"/>
</td>
<td>
<xsl:value-of select="current_phone_number"/>
</td>
</tr>
</xsl:if>

</xsl:when>

<xsl:otherwise>
<xsl:if test="last_name=$lname or first_name=$fname">
<tr>
<td>
<strong>
<xsl:value-of select="first_name"/> <xsl:value-of select="last_name"/>
</strong>
</td>
<td>
<xsl:value-of select="title"/>
</td>
<td>
<xsl:value-of select="office_id"/>
</td>
<td>
<xsl:value-of select="new_extension"/>
</td>
<td>
<xsl:value-of select="current_phone_number"/>
</td>
</tr>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</table>

</xsl:template>
</xsl:stylesheet>

please help me
 
Old December 27th, 2015, 10:33 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Hopefully this Q&A should point you in the right direction:

http://stackoverflow.com/questions/1...ument-function
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to process multiple input xml files with a single xslt ? Divya XSLT 12 October 9th, 2018 03:01 AM
Processing XSLT on multiple files Daedalus XSLT 6 August 28th, 2012 10:59 AM
Help needed transforming XML using multiple XSLT files. LenovoThinkCentre XSLT 2 August 28th, 2012 06:38 AM
Merging multiple xml files into a single xml file Pauletta XSLT 4 April 18th, 2012 10:13 AM
Combine multiple xml files to create one xml file jonnyuk3 XSLT 6 March 29th, 2012 11:51 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.