Click here to Skip to main content
15,915,094 members
Home / Discussions / XML / XSL
   

XML / XSL

 
GeneralRe: Calling a template recursively?? Pin
Rocky#5-Sep-07 19:50
Rocky#5-Sep-07 19:50 
GeneralRe: Calling a template recursively?? Pin
Rocky#6-Sep-07 1:30
Rocky#6-Sep-07 1:30 
GeneralRe: Calling a template recursively?? Pin
George L. Jackson6-Sep-07 1:54
George L. Jackson6-Sep-07 1:54 
GeneralRe: Calling a template recursively?? Pin
Rocky#6-Sep-07 2:17
Rocky#6-Sep-07 2:17 
GeneralRe: Calling a template recursively?? Pin
George L. Jackson6-Sep-07 2:25
George L. Jackson6-Sep-07 2:25 
GeneralRe: Calling a template recursively?? Pin
Rocky#6-Sep-07 2:33
Rocky#6-Sep-07 2:33 
GeneralRe: Calling a template recursively?? Pin
George L. Jackson6-Sep-07 2:41
George L. Jackson6-Sep-07 2:41 
GeneralRe: Calling a template recursively?? [modified] Pin
Rocky#6-Sep-07 20:33
Rocky#6-Sep-07 20:33 
I was thinking abt starting a new articles on this but then I changed my mind again... I'm back to the recursive solution again bcz the previous one wasn't showing the right sequence and this recursive one gets a nodeset missed when it starts recursion.

I'm giving the template I made and the XML I'm using.

Here comes the Template!

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>

<head>
<link rel="stylesheet" type="text/css" href="log_style.css" />
<title>Recursive Solution</title>
</head>
<body>
<xsl:apply-templates select="*"/>
</body>
</html>
</xsl:template>
<!--<xsl:template match="CallSequence">
<xsl:for-each select="Call">
<xsl:choose>
<xsl:when test="CallSequence">
<xsl:apply-templates select="CallSequence"/>
</xsl:when>
<xsl:otherwise>
Process the other child nodes
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
-->




<!--Starting: TRYING THE NEW TEMPLATE.... USING Call-Template function-->
<xsl:template name="CallSequenceTemplate" match="CallSequence">
<xsl:for-each select="Call">
<xsl:choose>
<xsl:when test="CallSequence">
<xsl:apply-templates select="CallSequence"/>
</xsl:when>
<xsl:otherwise>
<table>
<br/>
<tr>
<td class='heading3'><b>Call to <xsl:value-of select="Method"/></b></td>
</tr>
</table>


<table width="100%">
<tr><td width="10%">Object Type&#160;</td><td><i><xsl:value-of select="ObjectType"/></i></td></tr>
<tr><td>Object Name&#160;</td><td><i><xsl:value-of select="ObjectName"/></i></td></tr>
<tr><td>Interface Name&#160;</td><td><i><xsl:value-of select="Interface"/></i></td></tr>
<tr><td>Return Code&#160;</td><td><i><xsl:value-of select="ReturnCode"/></i></td></tr>
</table>

<xsl:for-each select="Arguments">
<table width = "100%" border="0" class="border" cellpadding="0" cellspacing="1">
<tr><td class='heading4'>&#160;</td></tr>

<xsl:if test="Results/Value">
<tr class="nonSelectedRow">
<td colspan="6" class = 'detail_table_element'><b>Inputs</b></td>
</tr>
</xsl:if>

<xsl:if test="Results/Compound">
<tr class="nonSelectedRow">
<td colspan="4" class = 'detail_table_element'><b>Inputs</b></td>
<td colspan="2" class = 'detail_table_element'><b>Output</b></td>
</tr>
</xsl:if>

<tr class="nonSelectedRow">
<xsl:for-each select="*[name() != 'Results'] | Results/child::node()[1] | Results/child::node()[1] / child::node()[2]">
<th><xsl:value-of select="name()"/></th>
</xsl:for-each>
</tr>

<tr>
<xsl:for-each select="*[node() and name() != 'Results']">
<td valign = "top"><xsl:value-of select="node()"/></td>
</xsl:for-each>

<xsl:if test="Results/Compound">
<td>
<table border="0" width = "100%">
<xsl:for-each select="Results/Compound">
<tr>
<td><xsl:value-of select="Name"/></td>
</tr>
</xsl:for-each>
</table>
</td>

<td>
<table border="0" width = "100%">
<xsl:for-each select="Results/Compound">
<tr>
<td><xsl:value-of select="Value"/></td>
</tr>
</xsl:for-each>
</table>
</td>
</xsl:if>

<xsl:if test="Results/Value">
<xsl:for-each select="Results">
<td><xsl:value-of select="Value"/></td>
</xsl:for-each>
</xsl:if>
</tr>

</table>
</xsl:for-each> <!--Arguments foreach ending-->
</xsl:otherwise>
</xsl:choose>



</xsl:for-each> <!--Main outer foreach ending-->
</xsl:template><!--CallSequenceTemplate Ending-->
<!--Ending: TRYING THE NEW TEMPLATE.... USING Call-Template function-->

</xsl:stylesheet>


------------------

AND here's the XML

-----------------
<?xml version="1.0" encoding="utf-8"?>
<?xml:stylesheet type="text/xsl" href="d:\\unit example recursive.xsl"?>
<LOG>
<LoggedProgram>C:\Program Files\AspenTech\Aspen HYSYS 2004\hysys.exe</LoggedProgram>
<LogConfiguration>C:\Program Files\Co-LaN\CAPE-OPEN Logger\CAPE-OPENLogs.ini</LogConfiguration>
<LoggedComponent>
<Name>MixNSplit 12</Name>
<CAPE-OPENVersion>1.0</CAPE-OPENVersion>
<Implementation>DLL</Implementation>
<Location>C:\Program Files\Common Files\AspenTech Shared\CAPE-OPEN Example Models\AspenCOUnit100.dll</Location>
<LoggerStatus>Loaded Successfully</LoggerStatus>
</LoggedComponent>
<CallSequence>
<Call>
<ObjectType>Unit</ObjectType>
<ObjectName>ChemSepUO_382</ObjectName>
<Interface>ICapeUnit</Interface>
<Method>get_ports</Method>
<ReturnCode>No Error</ReturnCode>
</Call>
<Call>
<ObjectType>Unit</ObjectType>
<ObjectName>ChemSepUO_382</ObjectName>
<Interface>ICapeUnit</Interface>
<Method>Validate</Method>
<ReturnCode>No Error</ReturnCode>
<Message>No inlet streams have been connected to this block</Message>
</Call>
<Call>
<ObjectType>Unit</ObjectType>
<ObjectName>ChemSepUO_382</ObjectName>
<Interface>ICapeUnit</Interface>
<Method>Calculate</Method>
<CallSequence>
<Call>
<ObjectType>Material Object</ObjectType>
<ObjectName>Mix out</ObjectName>
<Interface>ICapeThermoMaterialObject</Interface>
<Method>SetProp</Method>
<Arguments>
<Property>Volume</Property>
<Phase>Overall</Phase>
<Basis>Mole</Basis>
<Calc>Mixture</Calc>
<Results>
<Value>0.000018075</Value>
</Results>
</Arguments>
<ReturnCode>No Error</ReturnCode>

</Call>
<Call>
<ObjectType>Material Object</ObjectType>
<ObjectName>Mix out</ObjectName>
<Interface>ICapeThermoMaterialObject</Interface>
<Method>GetProp</Method>
<Arguments>
<Property>Fraction</Property>
<Phase>Overall</Phase>
<Basis>mole</Basis>
<Calc>null</Calc>
<Results>
<Compound>
<Name>Hydrogen</Name>
<Value>0.355979900</Value>
</Compound>
<Compound>
<Name>Methane</Name>
<Value>0.018735784</Value>
</Compound>
<Compound>
<Name>Benzene</Name>
<Value>0.401813320</Value>
</Compound>
<Compound>
<Name>Toluene</Name>
<Value>0.223470992</Value>
</Compound>
<Compound>
<Name>BiPhenyl</Name>
<Value>0.000000005</Value>
</Compound>
<Compound>
<Name>H2O</Name>
<Value>0.703552320</Value>
</Compound>
</Results>
</Arguments>
<ReturnCode>No Error</ReturnCode>
</Call>
</CallSequence>
<ReturnCode>No Error</ReturnCode>
</Call>
<Call>
<ObjectType>testing object</ObjectType>
<ObjectName>Backto 1st</ObjectName>
<Interface>Rocky</Interface>
<Method>Checking the sequence </Method>
<ReturnCode>no</ReturnCode>
<Message>checking the back track</Message>
</Call>
</CallSequence>
</LOG>

---------------------------------------------------
I'm sorry for giving such a long post but if u see the results u can see what the problem is... Can u or any buddy plz remove this bug!!. I've tried my heart out since yesterday and its not working!Frown | :(

Rocky

You can't climb up a ladder with your hands in your pockets.


-- modified at 2:44 Friday 7th September, 2007
GeneralFound where the bug is now Pin
Rocky#6-Sep-07 21:20
Rocky#6-Sep-07 21:20 
GeneralRe: Calling a template recursively?? Pin
Rocky#7-Sep-07 0:09
Rocky#7-Sep-07 0:09 
GeneralRe: Calling a template recursively?? Pin
George L. Jackson7-Sep-07 2:49
George L. Jackson7-Sep-07 2:49 
GeneralRe: Calling a template recursively?? Pin
Rocky#8-Sep-07 0:10
Rocky#8-Sep-07 0:10 
GeneralRe: Calling a template recursively?? Pin
Rocky#10-Sep-07 21:45
Rocky#10-Sep-07 21:45 
GeneralRe: Calling a template recursively?? Pin
George L. Jackson11-Sep-07 0:30
George L. Jackson11-Sep-07 0:30 
GeneralRe: Calling a template recursively?? Pin
Rocky#11-Sep-07 0:49
Rocky#11-Sep-07 0:49 
QuestionWDSL Jagged array problem Pin
sander BB4-Sep-07 23:20
sander BB4-Sep-07 23:20 
QuestionProblem in using call-template Pin
Rocky#4-Sep-07 23:13
Rocky#4-Sep-07 23:13 
AnswerRe: Problem in using call-template Pin
George L. Jackson5-Sep-07 1:51
George L. Jackson5-Sep-07 1:51 
QuestionHow to Check whether we can use XSL 2.0? Pin
Rocky#3-Sep-07 21:39
Rocky#3-Sep-07 21:39 
AnswerRe: How to Check whether we can use XSL 2.0? Pin
George L. Jackson4-Sep-07 0:34
George L. Jackson4-Sep-07 0:34 
GeneralRe: How to Check whether we can use XSL 2.0? Pin
ChrisKo4-Sep-07 13:40
ChrisKo4-Sep-07 13:40 
GeneralRe: How to Check whether we can use XSL 2.0? Pin
George L. Jackson4-Sep-07 16:26
George L. Jackson4-Sep-07 16:26 
Questionread xml using javascript Pin
pradeep kumarappagari3-Sep-07 1:37
pradeep kumarappagari3-Sep-07 1:37 
Questionhow to put a space between the word e,g 'LogConfig' = 'Log Config' Pin
Rocky#3-Sep-07 1:27
Rocky#3-Sep-07 1:27 
Questionxmlbulkload Pin
Panchal Hardik3-Sep-07 1:16
Panchal Hardik3-Sep-07 1:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.