Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 1st, 2008, 08:44 AM
Authorized User
 
Join Date: Jun 2008
Location: , , .
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default Array like processing (Xpath 1 / XSLT 1)

I am building a new XML out of an XML. But first, I have to perform some validation/translation routines and db read that will build the target text() node. This extra process will "suspend" the XSLT processing so I will have to pass a number of times between XMLs to build a new XML. It's like an array handling routine where the array is populated and read back later.

Assuming, XML_01 contains a starting point element like

<value/>

XML_02 will be iterated. On each pass a new node/path is derived

First pass:

 <field name="field1">data 1</field>

Second pass:

 <field name="field2">data 2</field>

Third pass:

 <field name="field3">data 3</field>


On each pass above, XML_01 evolves into

First pass:

<value>
 <field name="field1">data 1</field>
</value>

Second pass:

<value>
 <field name="field1">data 1</field>
 <field name="field2">data 2</field>
</value>

Third pass - final:

<value>
 <field name="field1">data 1</field>
 <field name="field2">data 2</field>
 <field name="field3">data 3</field>
</value>


The reason I'm doing this is because I need to hold more than 40 or so fields and field values. Having a token to hold all of them individually maybe too cumbersome to maintain.

Thanks for the usual guidance!


 
Old July 2nd, 2008, 02:22 AM
Authorized User
 
Join Date: Jun 2008
Location: , , .
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I will answer my own inquiry. :D

Array like processing needs another xslt physically residing somewhere that needs to be imported to the one XSLT that builds the target XML.

Which is a luxury that I don't have.

So, I had to amend my validation lookup table by introducing

- use_flag if I need the field in the target XML
- mapping field
- and the node-set() instruction to find the data from the source XML

By putting the Xpath logic in the database, my XSLT code becomes simple and cleaner.












Similar Threads
Thread Thread Starter Forum Replies Last Post
JAXP and XSLT 2.0 / XPATH 2.0 ojasrege XSLT 2 November 27th, 2007 10:40 AM
xslt xpath boris17 XSLT 2 October 15th, 2007 05:31 PM
conditional xslt processing based on java array twilson997 XSLT 7 June 28th, 2006 07:32 AM
XSLT -XPATH Error xslspy XSLT 1 October 27th, 2005 03:24 AM
XSLT/XPATH Help KombatKarl XSLT 3 September 2nd, 2004 07:35 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.