473,387 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

XSLT issue by rajan

Hi

How can i get the single node value if i have node value is in multiple nodes under parent node.
I need <START_DATE> in output ..what code should i need to write in XSL so that below XML give me <START_DATE> only once whichever found first in multiple nodes for same <ASSET_NUMBER> and <PAYMENT_TYPE>

I am getting <START_DATE> for each node in output..Suppose if there is no <START_DATE> in first node it should print 2nd node<START_DATE> ..If found in first then no check for other nodes and it should print first <START_DATE> in output

Eg of 2 nodes given as:

XML Code
--------------


<XXD_PMT_TBL_TYPE>
<KHR_ID>558965</KHR_ID>
<CLE_ID>124374202321956236402685913568035337442</CLE_ID>
<CONTRACT_LINE_TYPE>Financial Asset ne</CONTRACT_LINE_TYPE> <ASSET_NUMBER>LP501100</ASSET_NUMBER> <PAYMENT_TYPE>RENT</PAYMENT_TYPE>
<STRUCTURE>0</STRUCTURE> <FREQUENCY>M</FREQUENCY>
<ARREARS>Y</ARREARS>
<START_DATE>2007-05-01T00:00:00</START_DATE>
</XXD_PMT_TBL_TYPE>
<XXD_PMT_TBL_TYPE>
<KHR_ID>558965</KHR_ID>
<CLE_ID>124738878561124662445007628105477903460</CLE_ID>
<CONTRACT_LINE_TYPE>Financial Asset Line</CONTRACT_LINE_TYPE>
<ASSET_NUMBER>LP501100</ASSET_NUMBER>
<PAYMENT_TYPE>RENT</PAYMENT_TYPE>
<STRUCTURE>0</STRUCTURE> <FREQUENCY>M</FREQUENCY>
<ARREARS>Y</ARREARS>
<START_DATE>2008-04-01T00:00:00</START_DATE>
</XXD_PMT_TBL_TYPE>







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


My XSLT looks like:


---------------------
<interimRent>
<xsl:for-each select="$Vvar3_CTA_PSS_SELECT_INQUIRY_Response/ora:X_PMT_TBL">
<xsl:for-each select="ora:XXD_PMT_TBL_TYPE">
<xsl:variable name="flag" select="position()"/>
<xsl:variable name="var_XXD_PMT_TBL_TYPE" select="."/>
<xsl:for-each select="ora:START_DATE">
<xsl:variable name="var_START_DATE" select="."/>
<xsl:for-each select="$var_XXD_ASSET_TBL_TYPE/ora:ASSET_NUMBER">
<xsl:variable name="var_ASSET_NUMBER" select="."/>
<xsl:for-each select="$var_XXD_PMT_TBL_TYPE/ora:ASSET_NUMBER">
<xsl:variable name="var1_ASSET_NUMBER" select="."/>
<xsl:variable name="var_RESULTOF_equal" select="$var_ASSET_NUMBER = $var1_ASSET_NUMBER"/>
<xsl:for-each select="$var_XXD_PMT_TBL_TYPE/ora:PAYMENT_TYPE">
<xsl:variable name="var_PAYMENT_TYPE" select="."/>
<xsl:variable name="var_CONST" select="'RENT'"/>
<xsl:variable name="var1_RESULTOF_equal" select="$var_PAYMENT_TYPE = $var_CONST"/>
<xsl:variable name="var_RESULTOF_logicaland" select="$var_RESULTOF_equal and $var1_RESULTOF_equal"/>
<xsl:if test="string($var_RESULTOF_logicaland)='true'">

<xsl:choose>
<xsl:when test="$flag">
<startDate>
... <xsl:value-of select="($var_START_DATE)}"/>
</startDate>
</xsl:when>
<xsl:otherwise> ...
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</interimRent>





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

this part above need code change in XSLT..Plz tell some logic to reassign flag value if possible ,how or anything if any1 work ..

<xsl:choose>
<xsl:when test="$flag">
<startDate>
... <xsl:value-of select="($var_START_DATE)}"/>
</startDate>
</xsl:when>
<xsl:otherwise> ...




Thanx in advance
rajan sood
Jan 2 '08 #1
2 1367
r u guys any problem to understand my query..if any issue plz ask
Jan 3 '08 #2
Dököll
2,364 Expert 2GB
Hello, rajan sood!

It looks like you need the XML forum, is this corect?
Jan 5 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Ringo Langly | last post by:
Hi all, I'm a seasoned web programmer, but I've never touched XSLT. It's always been one of those acronyms I've never needed to educate myself on. Now... we're working with a web content...
3
by: PeteMc | last post by:
Hi I'm new to c# and .net from a vb6 background and i'm having issues with the debugging of applications I am trying to create a watch on an expression aString.IndexOf(",",0).ToString() but...
14
by: David Blickstein | last post by:
I have some XML documents that I want to open in a web browser and be automatically translated to HTML via XSLT. I'm using an xml-stylesheet processing command in a file called "girml.xml". ...
12
by: Keith Chadwick | last post by:
I have a fairly hefty XSLT file that for the sake of debugging and clarity I wish to split into some separate sub-templates contained within the same file. The master template calls an...
4
by: Gauthier | last post by:
Hi, I've a simple issue with the use of extension objects. I'm trying to call a text formating method from an object that I add to my arguments collection, this method take an input string and...
6
by: Christopher | last post by:
I am currently in the process of evaluating the performance hits of moving to the .NET platform for our application. I created a sample project that loads the transforms the same XML and XSLT in...
6
by: kenundrum | last post by:
Hey all, I am having an issue with XML/XSLT and JavaScript in my ASP.NET page that I am creating. I first want to apologize if i placed this in the wrong category. Since there were three different...
6
by: ronburk | last post by:
Is there any standard way to control the end-of-line convention (LF versus CR/LF) for XSLT processor output? The obvious logical point to control this would be in xsl:output. However, Kay says...
2
by: Ronald Raygun | last post by:
I am running a build process (using propel) which requires XSLT for some transformations. I get the following error: "Could not perform XLST transformation. Make sure PHP has been...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.