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 October 28th, 2009, 01:21 PM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default Basic XSLT question

Hi, This is a very basic XSLT question. I've been using XSLT for years and never came across this. When I have a DTD that requires an attribute:

Code:
<!ENTITY % cluster.attrib 
  "cluster CDATA #IMPLIED
   permission (yes|no) 'yes'
   test (no | yes) 'no'"
>
And my input xml does not have these attributes, using the below template, will result with the attributes added to the elements of the resulting file.

Code:
    <xsl:template match="*">
        <xsl:copy>
            <xsl:copy-of select="@*"/>
            <xsl:apply-templates/>
        </xsl:copy>
    </xsl:template>
My questions is (using Saxon), how do I turn this off?
 
Old October 28th, 2009, 01:25 PM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

See the thread Copying without attributes with default values in dtd
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
The Following User Says Thank You to Martin Honnen For This Useful Post:
bonekrusher (October 28th, 2009)
 
Old October 28th, 2009, 01:33 PM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

Thanks. I believe with saxon, I can use

-dtd:(on|off|recover)

I'll need to comb through the docs for saxon in-bedded...

Phil
 
Old October 28th, 2009, 05:50 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

No, the -dtd option controls whether validation using the DTD is performed, and whether validation failures are fatal. It does not control the handling of defaulted attributes. That's done by the -expand option. (Though the two may interact, depending on which XML parser is used.)
__________________
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:
bonekrusher (October 28th, 2009)
 
Old October 28th, 2009, 05:53 PM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

Thanks Michael. Always a great help.





Similar Threads
Thread Thread Starter Forum Replies Last Post
help, basic xslt Yanson XSLT 4 June 19th, 2007 06:45 AM
Please HELP Very Basic Question jkoe578 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 November 18th, 2006 10:06 AM
xslt basic question kgoldvas XSLT 2 January 25th, 2006 02:48 PM
basic xslt Question abhishek verma XSLT 4 January 24th, 2006 05:35 AM
Basic XSLT problem.... johrik XSLT 2 February 6th, 2004 09:13 AM





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