Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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 September 2nd, 2004, 07:41 AM
Registered User
 
Join Date: Sep 2004
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>
      </Record>

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="">
</map>

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?

Hanna
 
Old September 2nd, 2004, 05:23 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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
http://saxon.sf.net/
 
Old September 5th, 2004, 03:21 AM
Registered User
 
Join Date: Sep 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

Stewart






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





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