XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Alex StarSubject: Is ther are any XSLT solutions available?
Author: Alex Star
Date: 27 Jun 2007 02:51 PM
Originally Posted: 27 Jun 2007 02:30 PM
I have next XML as input for my map:

<CPSData xmlns="http://3wworld.CPS">
<CPS xmlns="">
<CallSchedule>
<CallSchData/>
<CallSchData>2</CallSchData>
<CallSchData>1</CallSchData>
<CallSchData>2</CallSchData>
<CallSchData>5</CallSchData>
<CallSchData>02/01/2005</CallSchData>
<CallSchData>2</CallSchData>
<CallSchData>100.0000</CallSchData>
<CallSchData>5</CallSchData>
<CallSchData>02/01/2010</CallSchData>
<CallSchData>2</CallSchData>
<CallSchData>200.0000</CallSchData>
<CallSchData/>
</CallSchedule>
</CPS>
</CPSData>

I need to filter <CallSchData> and extract only the values of nodes following by the one with the value equal 5 (for <CallSchDate>) and 2(for CallSchValue). Also, I want to disregard first three nodes:
<CallSchData/>
<CallSchData>2</CallSchData>
<CallSchData>1</CallSchData>

So, the expected result should looks like this:

<CPSFinalData xmlns="http://3wworld.CPS_Final">
<CPS xmlns="">
<CallSchLoop>
<CallSchedule>
<CallSchDate>02/01/2005</CallSchDate>
<CallSchValue>100.0000</CallSchValue>
</CallSchedule>
<CallSchedule>
<CallSchDate>02/01/2010</CallSchDate>
<CallSchValue>200.0000</CallSchValue>
</CallSchedule>
</CallSchLoop>
</CPS>

</CPSFinalData>

I thoughted that I could handle it in the BizTalk map, but I guess, it is better to do using XSLT directly. The problem is - I am not that familiar with XSLT, so please help.
Thank you in advance,

Alex.

Postnext
Tony LavinioSubject: Is ther are any XSLT solutions available?
Author: Tony Lavinio
Date: 27 Jun 2007 09:38 PM
Which version of Stylus Studio are you using?

Postnext
Alex StarSubject: Is ther are any XSLT solutions available?
Author: Alex Star
Date: 28 Jun 2007 09:40 AM
I have Altova XML Spy.

Postnext
Tony LavinioSubject: Is ther are any XSLT solutions available?
Author: Tony Lavinio
Date: 28 Jun 2007 09:51 AM
This is a support forum for Stylus Studio users.
Please ask your questions on the appropriate Altova forum.

Postnext
Ian ThomasSubject: Is ther are any XSLT solutions available?
Author: Ian Thomas
Date: 28 Jun 2007 10:24 AM
</smirk>

Ian

Posttop
Alex StarSubject: Is ther are any XSLT solutions available?
Author: Alex Star
Date: 28 Jun 2007 11:19 AM
Actually, I am using Studio as well some times(latest release) and I am a registered user here(othervise, how would I be able to post a questions here).
I beleave it does not matter what tool you using - XSLT is a standard for both tools.

Thank you for the help, I have resolved this issue anyway already.
Here is how I did it:

<?xml version="1.0" encoding="utf-16" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0" xmlns:s0="http://3wworld.CPS"
exclude-result-prefixes="s0" >
<xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />
<xsl:template match="/">
<ns0:CPSFinalData xmlns:ns0="http://3wworld.CPS_Final">
<xsl:if
test="/s0:CPSData/CPS/CallSchedule/CallSchData[text()='5' and
position() > 3]">
<CPS>
<CallSchLoop>
<xsl:for-each
select="/s0:CPSData/CPS/CallSchedule/CallSchData[text()='5']">
<CallSchedule>
<CallSchDate>
<xsl:value-of select="./following-sibling::CallSchData[1]/text()" />
</CallSchDate>
<CallSchValue>
<xsl:value-of
select="./following-sibling::CallSchData[1]/following-sibling::CallSchData[1]/following-sibling::CallSchData[1]/text()"
/>
</CallSchValue>
</CallSchedule>
</xsl:for-each>
</CallSchLoop>
</CPS>
</xsl:if>
</ns0:CPSFinalData>
</xsl:template>
</xsl:stylesheet>

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.