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 February 28th, 2012, 07:50 AM
Registered User
 
Join Date: Feb 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Calling xslt into xslt with different xml file

Hi,
I have a scenario like all pages of website are generated dynamically using xml and xslt.Each page is returned as xml and we apply xslt on xml to generate html page.
header and left menu are returned into one xml file.Now if i click on any link header and left menu disappear beacuse each link gets a different xml file.I have Generated xslt for left and header and want to include these two xslts into other xslt whichever is being displayed.
But the problem is Header and Left.XSLT are using different xml file,I m trying to call these two XSLTs into different XSLT,which is generating output.

Structure of XSLT in which i m calling header and left xslt is like this


<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
<xsl:include href="leftXSLT.xslt"/>
<xsl:include href="HeaderXSLT.xslt"/>

<xsl:output method="xml" indent="yes"/>
<xsl:variable name="raw" select="document('E:\IHIS\Mohali\Registration\patR egform.xml')" />
<xsl:template match="@* | node()">
<html>
<head>

<script src="validation/scriptaculous/lib/prototype.js" type="text/javascript"></script>
<script src="validation/scriptaculous/src/effects.js" type="text/javascript"></script>
<script type="text/javascript" src="validation/fabtabulous.js"></script>
<script type="text/javascript" src="validation/validation.js"></script>
<script language="javascript" type="text/javascript" >

function enablectrl()
{
var ii=document.getElementById("rdage");

if(ii.value='Age')

{

document.getElementById("txtage").style.visibility ="visible";

}
else
{
document.getElementById("txtdob").style.visibility ="visible";
}

}

</script>
<link rel="stylesheet" type="text/css" href="validation/style.css" />
<link rel="stylesheet" type="text/css" href="int_css.css" />
</head>


<body>

<div id="container">
<div id="container">
<xsl:call-template name="header"/>
<div id="contentarea">
<xsl:call-template name="left"/>
<div id="center-column">

<xsl:element name="form">

<xsl:attribute name="id">frm</xsl:attribute>
<xsl:attribute name="method">post</xsl:attribute>
<xsl:attribute name="action">Patregistration</xsl:attribute>

<table>
<!--For All Textboxes-->
<!--<xsl:for-each select=".//row[col='textbox']">-->
<xsl:for-each select=".//row">
<xsl:if test=".//col='textbox'">
<tr>
<td class="lbl">
<!--1st columns gets the Label name against textboxes in -->
<xsl:value-of select=".//col[@number=2]"/>
</td>
<!--2nd columns Draw a textbox -->

<td>

<xsl:choose>
<xsl:when test=".//col[@number=2]='Age'">
<xsl:element name="input">
<xsl:attribute name="type">
<xsl:value-of select=".//col[@number=3]"/></xsl:attribute>
<xsl:attribute name="name">txtage</xsl:attribute><xsl:attribute name="maxlength">
<xsl:value-of select=".//col[@number=6]"/>
</xsl:attribute>
<!--Visible set to false intially for DOB and AGE -->
<xsl:attribute name="style">visibility:hidden</xsl:attribute>
<xsl:attribute name="class">txtbox</xsl:attribute>
</xsl:element>
</xsl:when>
</xsl:choose>

<xsl:choose>
<xsl:when test=".//col[@number=2]='DOB'">
<xsl:element name="input">
<xsl:attribute name="type">
<xsl:value-of select=".//col[@number=3]"/></xsl:attribute>
<xsl:attribute name="name">txtdob</xsl:attribute>
<xsl:attribute name="maxlength">
<xsl:value-of select=".//col[@number=6]"/></xsl:attribute>
<!--Visible set to false intially for DOB and AGE -->
<xsl:attribute name="style">visibility:hidden</xsl:attribute>
<xsl:attribute name="class">txtbox</xsl:attribute>
</xsl:element>
</xsl:when>
</xsl:choose>
<xsl:variable name="txtid" select=".//col[@number=1]"></xsl:variable>

<xsl:choose>
<!--For applying javascript function in case of required fields-->
<xsl:when test=".//col[@number=1]='BL_IS_ACTUAL_DOB'">

</xsl:when>
<xsl:otherwise >
<xsl:element name="input">
<xsl:attribute name="type">
<xsl:value-of select=".//col[@number=3]"/>
</xsl:attribute>
<xsl:attribute name="name">
<xsl:value-of select=".//col[@number=1]"/>
</xsl:attribute>
<xsl:attribute name="maxlength">
<xsl:value-of select=".//col[@number=6]"/>
</xsl:attribute>
<xsl:attribute name="class">required txtbox</xsl:attribute>
</xsl:element>
</xsl:otherwise>
</xsl:choose>

</td>

</tr>
</xsl:if>
<!--For All combo boxe-->
<xsl:if test=".//col='Combo'">
<tr>
<td class="lbl">
<!--1st columns gets the Label name against textboxes in -->
<xsl:value-of select=".//col[@number=2]"/>
</td>
<!--2nd columns Draw a textbox -->
<td>
<xsl:variable name="comboid" select=".//col[@number=1]"></xsl:variable>
<xsl:element name="select">
<!--For applying javascript function in case of required fields-->

<xsl:choose>
<xsl:when test=".//col[@number=4]='Y'">
<xsl:attribute name="class">required</xsl:attribute>
</xsl:when>
</xsl:choose>
<xsl:attribute name="name">
<xsl:value-of select="$comboid"/>
</xsl:attribute>

<xsl:for-each select="$raw//*[@id=$comboid]">
<xsl:for-each select=".//option">
<xsl:element name="option">
<xsl:attribute name="value">
<xsl:value-of select=".//value"/>
</xsl:attribute>
<xsl:value-of select=".//display"/>
</xsl:element>
</xsl:for-each>
</xsl:for-each>


</xsl:element>
</td>

</tr>
</xsl:if>
<!--For All radiobuttons-->
<xsl:if test=".//col='radio'">
<tr>
<td class="lbl">
<!--1st columns gets the Label name against radiobutton -->
<xsl:value-of select=".//col[@number=2]"/>
</td>
<!--2nd columns Draw a radiobutton -->
<td>
<xsl:variable name="radioid" select=".//col[@number=1]"></xsl:variable>

<xsl:for-each select="$raw//*[@id=$radioid]">

<xsl:choose>
<xsl:when test="$radioid='BL_IS_ACTUAL_DOB'">

<xsl:element name="input">
<xsl:attribute name="type">radio</xsl:attribute>
<xsl:attribute name="id">radio</xsl:attribute>
<xsl:attribute name="name">
<xsl:value-of select="$radioid"/>
</xsl:attribute>
<xsl:attribute name="onclick">enablectrl()</xsl:attribute>
<xsl:attribute name="value">Age</xsl:attribute>
<xsl:attribute name="class"> radio</xsl:attribute>
</xsl:element>Age

<xsl:element name="input">
<xsl:attribute name="type">radio</xsl:attribute>
<xsl:attribute name="name">
<xsl:value-of select="$radioid"/>
</xsl:attribute>
<xsl:attribute name="onclick">enablectrl()</xsl:attribute>
<xsl:attribute name="value">DOB</xsl:attribute>
<xsl:attribute name="class">radio</xsl:attribute>
</xsl:element>DOB

</xsl:when>
<xsl:otherwise>
<xsl:element name="input">
<xsl:attribute name="type">radio</xsl:attribute>
<xsl:attribute name="name">
<xsl:value-of select="$radioid"/>
</xsl:attribute>
<xsl:attribute name="onclick">enablectrl()</xsl:attribute>
<xsl:attribute name="value">0</xsl:attribute>
<xsl:attribute name="class">radio</xsl:attribute>
</xsl:element>
</xsl:otherwise>
</xsl:choose>

<!--<xsl:if test="$radioid='BL_IS_ACTUAL_DOB'">
<xsl:element name="input">
<xsl:attribute name="type">radio</xsl:attribute>
<xsl:attribute name="name">
<xsl:value-of select="$radioid"/>
</xsl:attribute>
<xsl:attribute name="onclick">enablectrl()</xsl:attribute>
<xsl:attribute name="value">0</xsl:attribute>

</xsl:element>
</xsl:if>

<xsl:element name="input">
<xsl:attribute name="type">radio</xsl:attribute>
<xsl:attribute name="name">
<xsl:value-of select="$radioid"/>
</xsl:attribute>
<xsl:attribute name="onclick">enablectrl()</xsl:attribute>
<xsl:attribute name="value">0</xsl:attribute>
</xsl:element>-->

</xsl:for-each>
</td>
</tr>

</xsl:if>





</xsl:for-each>
<tr>
<td colspan="2" aling="centre">
<input type="submit" class="btn" name="Register Patient"></input>
</td>
</tr>
</table>
</xsl:element>

<script type="text/javascript">
new Fabtabs('tabs');
</script>

<script type="text/javascript">
var valid2 = new Validation('frm', {useTitles:true});
</script>


</div>
</div>
</div>
</div>



</body>
</html>
</xsl:template>
</xsl:stylesheet>


Left.xslt and Header.xslt are using different xml and FM.XSLT is using different xml.

Please suggest is possbile call xslts like the way i m using above.

Thanks & regards,
Ruchi





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to convert this xml file into Target xml file using XSLT sudheer2250 XSLT 6 June 10th, 2011 01:46 PM
Convert XML file using XSLT sushil.sharma75 XSLT 13 November 20th, 2009 01:59 PM
Modifiying XML File using XSLT brianlan XSLT 1 October 2nd, 2007 03:14 PM
merge two xml file and make new xml using xslt ketan XSLT 0 September 21st, 2004 08:48 AM
Merge XML files into a xml file using xslt lxu XML 4 November 6th, 2003 06:01 PM





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