[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Grouping based on element content

Subject: Grouping based on element content
From: "Ganesh Babu N" <nbabuganesh@xxxxxxxxx>
Date: Tue, 25 Nov 2008 18:57:17 +0530
 Grouping based on element content
Dear All,

Inspired by the Bob DuCharme article on Automating Stylesheet
Creation, I am trying to create automatic XSL from meta XML prepared
from a table. Here is the XML file of mapping table and needs to be
converted into source and target groups based on "to". But when i
apply my stylesheet all the <Cell> are getting converted into
<source>. Please guide me where I am going wrong.

Input XML:

 <Row>
    <Cell><Data ss:Type="String">doi</Data></Cell>
    <Cell><Data ss:Type="String">pii</Data></Cell>
    <Cell><Data ss:Type="String">aid</Data></Cell>
    <Cell><Data ss:Type="String">to</Data></Cell>
    <Cell><Data ss:Type="String">article-id</Data></Cell>
    <Cell><Data ss:Type="String">@doi</Data></Cell>
    <Cell><Data ss:Type="String">@pii</Data></Cell>
    <Cell><Data ss:Type="String">@publisher-id</Data></Cell>
   </Row>

XSL:

<xsl:template match="ss:Row">
<xsl:element name="map">
<xsl:for-each-group select="ss:Cell/ss:Data"
group-ending-with="*[text() eq 'to']">
<xsl:for-each select="current-group()">
<source><xsl:apply-templates/></source>
</xsl:for-each>
</xsl:for-each-group>
</xsl:element>
</xsl:template>

Expected output:
 <map>
    <source>doi</source>
    <source>pii</source>
    <source>aid</source>
    <target>article-id</target>
    <target>@doi</target>
    <target>@pii</target>
    <target>@publisher-id</target>
   </map>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.