XSL - PROBLEMA CON FOR ANIDADO

   
Vista:

PROBLEMA CON FOR ANIDADO

Publicado por Raquel (1 intervención) el 06/08/2008 17:43:31
Hola tenog un problema con la obtencion de datos con un for anidado... el XML que tengo es el siguiente...
<TrafficRecord>
<UnitTypeName>SMS</UnitTypeName>
<StartCallDateTime>20080618144325</StartCallDateTime>
<EndCallDateTime>20080618144325</EndCallDateTime>
<UsageAmount>1</UsageAmount>
<ApplicationName>SMS</ApplicationName>
<SubTypeName>MOSC_MOV-DGTL_SMS</SubTypeName>
<StartCallDateTimeTypeName>NULL</StartCallDateTimeTypeName>
<EndCallDateTimeTypeName>NULL</EndCallDateTimeTypeName>
<DestinyNumber>584123698521</DestinyNumber>
<CallDuration>NULL</CallDuration>
<CallType>NULL</CallType>
<CellID>NULL</CellID>
<Cost>0.00</Cost>
<UsageCredit>Bono</UsageCredit>
<PersonalBalance>4.59</PersonalBalance>
<CurrencyBalance>6.59</CurrencyBalance>
<CurrencyUsage>0.00</CurrencyUsage>
<KbBalance>0</KbBalance>
<KbUsage>0.00</KbUsage>
<SECBalance>550</SECBalance>
<SECUsage>0</SECUsage>
<SMSBalance>993</SMSBalance>
<SMSUsage>1</SMSUsage>
<Balances>
<Balance>
<Balance>1</Balance>
<AccountExpiration>20320101000000</AccountExpiration>
<BalanceName>F_SMS</BalanceName>
<AvailableBalance>993</AvailableBalance>
<FundsType>BalanceOnly</FundsType>
</Balance>
</Balances>
</TrafficRecord>

Necesito ontener la lista de balances relacionada con cada traficc record puede ser uno o mas traffic record y uno o mas balances.... pero necesito que los balnaces me salgan con el traffic record correspondiente... es decir algo asi como rspuesta..

<PropertySet DGTRptaIntegracion="0 RTBS_TLS-OM0001 Operación ejecutada de forma exitosa" />
<PropertySet UnitTypeName="SMS" StartCallDateTime="20080618144325" EndCallDateTime="20080618144325" UsageAmount="1" ApplicationName="SMS" SubTypeName="MOSC_MOV-DGTL_SMS" StartCallDateTimeTypeName="NULL" EndCallDateTimeTypeName="NULL" DestinyNumber="584123698521" CallDuration="NULL" CallType="NULL" CellID="NULL" Cost="0.00" UsageCredit="Bono" PersonalBalance="4.59" CurrencyBalance="6.59" CurrencyUsage="0.00" KbBalance="0" KbUsage="0.00" SECBalance="550" SECUsage="0" SMSBalance="993" SMSUsage="1">
<PropertySet Balance="1" AccountExpiration="20320101000000" BalanceName="F_SMS" AvailableBalance="993" FundsType="BalanceOnly" />

</PropertySet>
<PropertySet UnitTypeName="VOICE CALL" StartCallDateTime="20080616150125" EndCallDateTime=">20080616152325" UsageAmount="31" ApplicationName="VOICE CALL" SubTypeName="MOC_MOV-MOVOTRO_VC" StartCallDateTimeTypeName="NULL" EndCallDateTimeTypeName="NULL" DestinyNumber="584147106617" CallDuration="31" CallType="OutgoingCallAttempt" CellID="734020300600373" Cost="0.475" UsageCredit="Credito Personal" PersonalBalance="99.20" CurrencyBalance="100.20" CurrencyUsage="0.00" KbBalance="25" KbUsage="0" SECBalance="550" SECUsage="0" SMSBalance="994" SMSUsage="0">

<PropertySet Balance="0.475" AccountExpiration="20320101000000" BalanceName="Core" AvailableBalance="99.20" FundsType="BalanceOnly" />
<PropertySet Balance="12" AccountExpiration="20320101000000" BalanceName="NF_KB" AvailableBalance="25" FundsType="BalanceOnly" />


El proble que tengo con lo que hice actualmente es que por cada traffic record me muestra todos los balances que venga co el XML... lo que hice es lo siguiente..

<xsl:for-each select="//TrafficRecord">
<xsl:element name="PropertySet">
<xsl:attribute name="UnitTypeName"><xsl:value-of select="UnitTypeName"/></xsl:attribute>
<xsl:attribute name="StartCallDateTime"><xsl:value-of select="StartCallDateTime"/></xsl:attribute>
<xsl:attribute name="EndCallDateTime"><xsl:value-of select="EndCallDateTime"/></xsl:attribute>
<xsl:attribute name="UsageAmount"><xsl:value-of select="UsageAmount"/></xsl:attribute>
<xsl:attribute name="ApplicationName"><xsl:value-of select="ApplicationName"/></xsl:attribute>
<xsl:for-each select="//Balances/Balance">
<xsl:element name="PropertySet">
<xsl:attribute name="Balance"><xsl:value-of select="Balance"/></xsl:attribute>
<xsl:attribute name="AccountExpiration"><xsl:value-of select="AccountExpiration"/></xsl:attribute>
<xsl:attribute name="BalanceName"><xsl:value-of select="BalanceName"/></xsl:attribute>
<xsl:attribute name="AvailableBalance"><xsl:value-of select="AvailableBalance"/></xsl:attribute>
<xsl:attribute name="FundsType"><xsl:value-of select="FundsType"/></xsl:attribute>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:for-each>
</xsl:if>

Gracias por la ayuda!...
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder