Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 2nd, 2004, 07:41 AM
Registered User
Join Date: Sep 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Parsing and Looping through Pipe Delimetered data

Hi All,

I need to format some xml for a quick solution to meet a short term need. I think XSLT can do it from my research on the web and this forum but I am a newbie and stuggling to determine the best approach.

My XML looks like

      <Record Identifier="V0" DateModified="1899-12-30" TimeModified="00.00.01" Type="ContainerView" Readonly="0">
         <Property Name="StageList">V16S5|V16S6|V16S8|V0A60|V0S73|V0S 76|V0S79|V0S96|V0S97|V0A99|V19A0|V20A0</Property>
         <Property Name="StageXPos">624|624|216|183|216|408|408|48|79 2|48|383|585</Property>
         <Property Name="StageYPos">312|144|312|269|144|144|312|312|3 12|48|266|267</Property>
         <Property Name="StageTypes">CTransformerStage|CODBCStage|CTr ansformerStage|ID_PALETTEANNOTATION|CODBCStage|COD BCStage|CTransformerStage|CCustomStage|CCustomStag e|ID_PALETTEJOBANNOTATION|ID_PALETTEANNOTATION|ID_ PALETTEANNOTATION</Property>
         <Property Name="StageXSize">48|48|48|106|48|48|48|48|48|1007 |106|106</Property>
         <Property Name="StageYSize">48|48|48|319|52|48|48|48|48|72|3 19|319</Property>
         <Property Name="ContainerViewSizing">0031 0088 1301 0721 0000 0001 0000 0000</Property>

What I need to do is take this data and produce a image map looking like the example below with a area defined for each value in the 'StageList'. The below is an example for the fifth Stage in the list.

<map name="jobmap">
<area shape="rect" coords="216,147,263,198" href="#V0S73" ALT="">

The co-ordinates for the first point come from StageXPos and StageYPos for each matching value in StageList. The second point comes by adding StageXSize and StageYSize to both of these values.

I need to a) create a array to work with and then b) loop through this looking up each X,Y value and c) calculate the second point via a second lookup.

Any takers on this problem?

Reply With Quote
  #2 (permalink)  
Old September 2nd, 2004, 05:23 PM
mhkay's Avatar
Wrox Author
Points: 18,481, Level: 59
Points: 18,481, Level: 59 Points: 18,481, Level: 59 Points: 18,481, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,960
Thanks: 0
Thanked 292 Times in 287 Posts

This is much easier in XSLT 2.0 which has regular expression support. With 1.0, look for an implementation of the EXSLT str:tokenize function (see www.exslt.org). To write your own you will need to become familiar with recursive named templates.

Michael Kay
Reply With Quote
  #3 (permalink)  
Old September 5th, 2004, 03:21 AM
Registered User
Join Date: Sep 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Hi Michael,

Thanks for the reply. After some fustration I finally broke the problem down and solved it with some very crude code using substring-before and after with a reecursive template.


Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Data Parsing in C/C++ sgies C++ Programming 0 February 18th, 2008 12:36 PM
Parsing XML Data from a remote site timeware XML 1 June 1st, 2006 08:25 AM
How to Parse - Parsing Flat File Data - Asp darinsee Classic ASP Databases 5 May 24th, 2004 04:11 PM
Parse - Parsing Flat File Data - Asp darinsee Classic ASP Basics 1 May 22nd, 2004 08:39 AM
Parse - Parsing Flat File Data - Asp darinsee Classic ASP Components 1 May 22nd, 2004 08:19 AM

All times are GMT -4. The time now is 02:12 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.