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 February 3rd, 2009, 11:40 AM
Registered User
 
Join Date: Feb 2009
Posts: 1
Thanks: 1
Thanked 0 Times in 0 Posts
Default Filter XML file with an XSLT using DTD

Hi there,

I have an XML file like this one :
<Product>
<RecordReferences>123</RecordReferences>
<RecordReference>123</RecordReference> <NotificationType>99</NotificationType>
<ProductIdentifier>
<IDValue>abc</IDValue>
</ProductIdentifier>

</Product>

I have a DTD file like this one :
<!ENTITY%RecordReference"">
<!
ENTITY%NotificationType"">
<!ENTITY%ProductIdentifier"">
<!ENTITY%IDValue"">

I need a XSLT file that will select all elements from the XML file based on the DTD definition so the output XML file would be like this one :
<Product>
<RecordReference>123</RecordReference> <NotificationType>99</NotificationType>
<ProductIdentifier>
<IDValue>abc</IDValue>
</ProductIdentifier>

</Product>

I don't want to match each element one by one in the XSLT. I want a XSLT that will match all element specified in the DTD. Is this possible ?
 
Old February 3rd, 2009, 11:50 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

No, there's no automatic way of achieving this. I would recommend parsing the DTD (google for DTD Parser, there are several around but I have no recommendations) and generating an XSLT stylesheet from it, or perhaps an XML document which you can then use as input to an XSLT stylesheet.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
The Following User Says Thank You to mhkay For This Useful Post:
menhir666 (February 3rd, 2009)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Automated tool to convert XML from DTD to DTD lsantos2000 XSLT 2 October 17th, 2007 08:21 AM
how to parse the XML file and DTD through Xerces tufailfifa C++ Programming 0 June 25th, 2007 07:03 AM
how to parse the XML file and DTD tufailfifa XML 0 June 25th, 2007 07:02 AM
Can XSLT read DTD/schema and Generate XSLT.. ROCXY XSLT 1 November 6th, 2006 09:39 AM
How to use DTD file for a XML file cJeffreywang XML 0 November 9th, 2005 04:20 PM





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