Jump to content

Calling xslt into xslt with different xml file


navi25584

Recommended Posts

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\patRegform.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,Navpreet

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...