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 25th, 2007, 12:43 PM
Registered User
 
Join Date: Jul 2007
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help with parsing XML file (substitutions)

Hello,

I am attempting to parse an XML file using XSLT, and bought the XSLT 2.0 3rd Edition book to help me with this, but so far, I am stuck...

The XML file lists a series of parts, which are parsed during a process. Some parts will refer to a more generic part number (even though a part has a different part number, it could be the exact same part), and I would like to output the generic part instead.

There are actually more than one XML file involved with this, but this is the part I am stuck on right now.

So, example XML:

<parts>
  <part partNumber="12345678" name="Widget 1" />
  <part partNumber="12312312" name="Widget 2" />
    <part partNumber="ABC123" />
  <part partNumber="ABC123" name="Super Widget" />
</parts>

What I would like for output is:

<parts>
  <part partNumber="12345678" name="Widget 1" />
  <part partNumber="ABC123" name="Super Widget" />
</parts>

Anyone have suggestions on how I should approach this?




 
Old July 25th, 2007, 04:32 PM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

I'm finding it hard to relate your description of the problem to your XML. Where exactly is a part that refers to a more generic part number, and what form does the reference take? And why is part 12312312 (Widget 2) not present in the output?

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference




Similar Threads
Thread Thread Starter Forum Replies Last Post
parsing flat xml file using asp.net 2.0 mikecarmody XML 5 April 28th, 2008 02:55 AM
Help Parsing XML File Sojan80 XML 7 January 7th, 2008 06:09 PM
XML Parsing SCADA_Monkey XML 2 March 11th, 2007 03:20 PM
Date time substitutions markvivian VS.NET 2002/2003 2 October 14th, 2004 12:11 AM
Parsing xml file ?? bikash XML 3 September 5th, 2003 06:23 AM





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