Rank: Newbie
Joined: 8/6/2008 Posts: 1 Location: venezuela
|
hello i need some help wiht a XML transformatios... i have the next XML..
<RTBS_TLS_OUT> <SubscriberID>584120101939</SubscriberID> <SPName>DIGITEL</SPName> <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> </TrafficRecord> <Operation_Message> <Code> RTBS_TLS-OM0001</Code> <Message>Operación ejecutada de forma exitosa</Message> </Operation_Message> </RTBS_TLS_OUT>
I need that for each TRAFFICRECORD get all the BALANCES related.... i did one for inside other like this...
<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: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:element> </xsl:for-each> </xsl:element> </xsl:for-each> </xsl:if>
The problem that i have is that i get all the balances for all tha TRAFFICRECORD.. i mean y cant get only the balances related with the traffic record....
thanks....
|
Rank: Aficionado
Joined: 10/2/2007 Posts: 165 Location: Czech Republic
|
Hi, replace <xsl:for-each select="//Balances/Balance"> to <xsl:for-each select="Balances/Balance">
Petr
|