Re: [docbook] docbook5 and adding elements (long)
On 3/17/07, Chris Chiasson [EMAIL PROTECTED] wrote: snip I hate the reading, especially when I don't know exactly what I need to find. Experience: What you get after you needed it. /snip Oh boy, did this experience ever hurt. :( After a fair amount of reading and experimentation, I finally (doh!) realized that the key piece that I was missing is that xsltproc is *not* doing validation, and doesn't need to do validation. I had assumed that it would be a necessary step, but as I'm just looking for print output, I just don't need to worry about grammatically valid XML files. (But now I know how to generate the grammars should I ever want to do so. :) Thanks to a number of hints from Bob and Dick, I've got a workable solution for the question that I posited. Thanks guys! Sample command: == xsltproc --nonet --xinclude --output test.fo app.xsl test.xml c:\docbook\fop.bat test.fo test.pdf test.xml === ?xml version=1.0 encoding=UTF-8? book version=5.0 xmlns=http://docbook.org/ns/docbook; xmlns:xlink=http://www.w3.org/1999/xlink; xmlns:xi=http://www.w3.org/2001/XInclude; xmlns:svg=http://www.w3.org/2000/svg; xmlns:mml=http://www.w3.org/1998/Math/MathML; xmlns:html=http://www.w3.org/1999/xhtml; chapter titleHello world!/title paraSample explanatory text here/para para app server=server2 command bleh /command replaceablegreen/replaceable /app /para para app command bleh1 /command replaceableorange/replaceable /app /para /chapter /book app.xsl == ?xml version=1.0 encoding=UTF-8? xsl:stylesheet version=1.0 xmlns=http://docbook.org/ns/docbook; xmlns:db=http://docbook.org/ns/docbook; xmlns:xsl=http://www.w3.org/1999/XSL/Transform; xmlns:fo=http://www.w3.org/1999/XSL/Format; xsl:import href=file:///c:/docbook/lib/docbook5-xsl-1.72.0/fo/docbook.xsl/ !-- Pretty print the FO output tree (please! :) -- xsl:output encoding=UTF-8 indent=yes / xsl:template match=db:app fo:inline font-family=monospaceapp: xsl:choose xsl:when test=./@server != '' xsl:value-of select=@server / /xsl:when xsl:otherwiseserver1/xsl:otherwise /xsl:choose#62; /fo:inline xsl:apply-templates / /xsl:template /xsl:stylesheet - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [docbook] docbook5 and adding elements (long)
Do you know of a good step-by-step example of customizing Docbook5 with RelaxNG? Have you seen the DocBook 5.0 Transition Guide? It has examples: http://www.docbook.org/docs/howto/ Bob Stayton Sagehill Enterprises DocBook Consulting [EMAIL PROTECTED] - Original Message - From: Kells Kearney [EMAIL PROTECTED] To: Bob Stayton [EMAIL PROTECTED] Cc: docbook@lists.oasis-open.org Sent: Friday, March 16, 2007 3:33 PM Subject: Re: [docbook] docbook5 and adding elements (long) On 3/15/07, Bob Stayton [EMAIL PROTECTED] wrote: Hi Kells, The DTD version of DocBook 5 does not have the %local.* parameter entities. All of the customization features are in the RelaxNG version, from which the DTD version is generated. Oh? Ooops! I didn't notice that in this variation. Thanks! If you don't want to customize the RelaxNG and generate a DTD from it, you Sigh. I'd love to customize the RelaxNG and generate a DTD from it, but unfortunately I really don't have the knowledge about how to do that, so I would really appreciate one good example to show me how. I'd like to do things the right way if I could. Do you know of a good step-by-step example of customizing Docbook5 with RelaxNG? ie no hand-waving and the rest is left as an exercise for the reader or implementation is trivial, just a simple example from which I can download the example files, execute commands and have a 90% chance of having the example work out of the box can just edit a copy of the DocBook 5 DTD. Because it is a flat structure with no parameter entities, editing it is straightforward, if sometimes tedious. You need to add your new element as you have, and you also need to edit any content models of elements that are to contain your new element. If you don't do that, then although the element name is valid, there is no place in the document where its position is valid. If I'm understanding you correctly, you mean that I need to put the new element into an appropriate place in the grammar so that there's enough context for the element to be properly processed. Is that right? If so, that makes sense but that generality isn't clear enough to help me at this stage of my understanding. I don't think you want to use ENTITY as the attribute type for server. Such an attribute would contain the name of an unparsed entity declared elsewhere, and I don't see that for server1, server2, etc. I think you want CDATA there. Okay. In your test.xml sample, the elements are not actually in the DocBook namespace. You declare the namespace with a db prefix, but you don't use the prefix. If you declare the namespace without a prefix, then your elements will be in that default namespace. Your app.xsl needs to import the stock docbook stylesheet (perhaps it does and you aren't showing that). Then the template that matches on Docbook elements must have the namespace prefix match=db:app. Then the call-template uses a name of db:prompt, but you don't define a template with that name. Also, it is unusual to define a template name using a namespace prefix. It looks a bit like you are trying to invoke the template that handles the prompt element to handle your app element, but XSLT doesn't work that way. Okay. Wow, this is really frustrating. :( The impression I'm getting is that I need to use XSL-FO to get what I want. Is that right? You might consider dropping back to DocBook4 so you don't have to deal with namespaces at the same time you are figuring other things out. Do you really need DocBook5? E No, I guess not, but isn't Docbook5 supposed to save the universe? :) Quite honestly, LaTeX would be a much faster path for me to getting publication-quality print output (after all, it was generating good stuff for me 15 years ago! :), but there a number of compelling advantages (IMO) to using Docbook. (I think! :) Bob Stayton Sagehill Enterprises DocBook Consulting [EMAIL PROTECTED] - Original Message - From: Kells Kearney [EMAIL PROTECTED] To: docbook@lists.oasis-open.org Sent: Tuesday, March 13, 2007 4:13 PM Subject: [docbook] docbook5 and adding elements (long) I've taken a look through the e-mail archives, and I've tried googling, but I'm unable to find an answer to why I can't do something that should be quite simple. :( I've found documentation for how to do it using Docbook 4.x (and had no luck using it with Docbook 5), but it *seems* like a good thing to do it in Docbook 5. (Right?) I'm hoping that some kind soul can help me understand what it is that I'm doing wrong. I think that all I need is one good example. Thanks in advance! kells What I'm trying to do: I would like to be able to create an application-specific prompt to create documentation for the application. The prompt looks like: app: server_name where I'd like to define server_name in an entity as an attribute with a reasonable default
Re: [docbook] docbook5 and adding elements (long)
Bob Stayton wrote: Do you know of a good step-by-step example of customizing Docbook5 with RelaxNG? Have you seen the DocBook 5.0 Transition Guide? It has examples: http://www.docbook.org/docs/howto/ A very good read IMHO. If you search through the archives of this mailing list, I posted a 'mini' docbook, simple or some such title, which is a reduction to a tiny subset. It really is well designed for customisation. A dream compared to the entity method. http://www.dpawson.co.uk/nodesets/entries/051130.html and http://lists.oasis-open.org/archives/docbook-apps/200511/msg00107.html hth regards -- Dave Pawson XSLT XSL-FO FAQ. http://www.dpawson.co.uk - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [docbook] docbook5 and adding elements (long)
I have to apologize to both Dave and Bob, but they've given me far too much credit for understanding. :) I'm hoping that I can impose on your patience for just a little longer. On 3/17/07, Dave Pawson [EMAIL PROTECTED] wrote: Bob Stayton wrote: Do you know of a good step-by-step example of customizing Docbook5 with RelaxNG? Have you seen the DocBook 5.0 Transition Guide? It has examples: http://www.docbook.org/docs/howto/ I had read this before, but it doesn't actually show the basic mechanics so that I can just use it. For instance, * What programs are used to convert between the compact syntax and XML syntax? Thanks to the links from Dick Hamilton I understand that James Clark's 'trang' is most often used, but I'd never know that from the Transition Guide. * How do you use the resulting RelaxNG XML file in a real-world XML document? I gather from Bob Stayton's reply that I should convert the RNG files (my customizations + the Docbook5 RNG) to a DTD. I guess that means that I should just put a !DOCTYPE book SYSTEM mynew.DTD in the front of the document. Does that mean that I then throw out the namespaces? I think that the previous example of asmbook (extending Docbook5 with register and instruction elements) is really close, so with perhaps just a little bit of corrections and gap filling I'll have a good foundation to build up and test my understanding. Would it be possible for someone to post the (hopefully small) corrections to that example? Thanks to everyone so far for their kindness! A very good read IMHO. If you search through the archives of this mailing list, I posted a 'mini' docbook, simple or some such title, which is a reduction to a tiny subset. It really is well designed for customisation. A dream compared to the entity method. http://www.dpawson.co.uk/nodesets/entries/051130.html and http://lists.oasis-open.org/archives/docbook-apps/200511/msg00107.html hth regards -- Dave Pawson XSLT XSL-FO FAQ. http://www.dpawson.co.uk - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [docbook] docbook5 and adding elements (long)
* How do you use the resulting RelaxNG XML file in a real-world XML document? The RNG files (or DTD files, if that's what you want to use) don't go in the XML file you are authoring. They are used by your editor to prevent you from entering invalid data and/or by your validator to identify documents that aren't conformant (and would likely not transform correctly once the stylesheets are applied). On 3/17/07, Kells Kearney [EMAIL PROTECTED] wrote: I have to apologize to both Dave and Bob, but they've given me far too much credit for understanding. :) I'm hoping that I can impose on your patience for just a little longer. On 3/17/07, Dave Pawson [EMAIL PROTECTED] wrote: Bob Stayton wrote: Do you know of a good step-by-step example of customizing Docbook5 with RelaxNG? Have you seen the DocBook 5.0 Transition Guide? It has examples: http://www.docbook.org/docs/howto/ I had read this before, but it doesn't actually show the basic mechanics so that I can just use it. For instance, * What programs are used to convert between the compact syntax and XML syntax? Thanks to the links from Dick Hamilton I understand that James Clark's 'trang' is most often used, but I'd never know that from the Transition Guide. * How do you use the resulting RelaxNG XML file in a real-world XML document? I gather from Bob Stayton's reply that I should convert the RNG files (my customizations + the Docbook5 RNG) to a DTD. I guess that means that I should just put a !DOCTYPE book SYSTEM mynew.DTD in the front of the document. Does that mean that I then throw out the namespaces? I think that the previous example of asmbook (extending Docbook5 with register and instruction elements) is really close, so with perhaps just a little bit of corrections and gap filling I'll have a good foundation to build up and test my understanding. Would it be possible for someone to post the (hopefully small) corrections to that example? Thanks to everyone so far for their kindness! A very good read IMHO. If you search through the archives of this mailing list, I posted a 'mini' docbook, simple or some such title, which is a reduction to a tiny subset. It really is well designed for customisation. A dream compared to the entity method. http://www.dpawson.co.uk/nodesets/entries/051130.html and http://lists.oasis-open.org/archives/docbook-apps/200511/msg00107.html hth regards -- Dave Pawson XSLT XSL-FO FAQ. http://www.dpawson.co.uk - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- http://chris.chiasson.name/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [docbook] docbook5 and adding elements (long)
Kells Kearney wrote: Have you seen the DocBook 5.0 Transition Guide? It has examples: http://www.docbook.org/docs/howto/ I had read this before, but it doesn't actually show the basic mechanics so that I can just use it. For instance, * What programs are used to convert between the compact syntax and XML syntax? Thanks to the links from Dick Hamilton I understand that James Clark's 'trang' is most often used, but I'd never know that from the Transition Guide. Then you need to read up on Relax NG. * How do you use the resulting RelaxNG XML file in a real-world XML document? I gather from Bob Stayton's reply that I should convert the RNG files (my customizations + the Docbook5 RNG) to a DTD. I guess that means that I should just put a !DOCTYPE book SYSTEM mynew.DTD in the front of the document. Does that mean that I then throw out the namespaces? No. You can validate with a Schema. Schema = dtd|W3C xsd | relax NG 'Jing' from James Clark allows you to validate an XML instance against a schema (relax ng in this case) I think that the previous example of asmbook (extending Docbook5 with register and instruction elements) is really close, so with perhaps just a little bit of corrections and gap filling I'll have a good foundation to build up and test my understanding. Would it be possible for someone to post the (hopefully small) corrections to that example? Not without hand holding. You go do the reading and come back with the questions. I'm sure you'll get help. regards -- Dave Pawson XSLT XSL-FO FAQ. http://www.dpawson.co.uk - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [docbook] docbook5 and adding elements (long)
Kells Kearney wrote: * What programs are used to convert between the compact syntax and XML syntax? Thanks to the links from Dick Hamilton I understand that James Clark's 'trang' is most often used, but I'd never know that from the Transition Guide. That's why customization examples are provided in both syntaxes (XML and compact) so you can choose syntax which better suits your toolchain. * How do you use the resulting RelaxNG XML file in a real-world XML document? Usually you need schema only for editing and for validation of your XML files: http://www.docbook.org/docs/howto/#editors http://www.docbook.org/docs/howto/#validators If there is something unclear about usage of editors or validators as described, let me know, I will try to improve text. -- -- Jirka Kosek e-mail: [EMAIL PROTECTED] http://xmlguru.cz -- Professional XML consulting and training services DocBook customization, custom XSLT/XSL-FO document processing -- OASIS DocBook TC member, W3C Invited Expert, ISO/JTC1/SC34 member -- Want to speak at XML Prague 2007 = http://xmlprague.cz/cfp.html signature.asc Description: OpenPGP digital signature
Re: [docbook] docbook5 and adding elements (long)
On 3/15/07, Bob Stayton [EMAIL PROTECTED] wrote: Hi Kells, The DTD version of DocBook 5 does not have the %local.* parameter entities. All of the customization features are in the RelaxNG version, from which the DTD version is generated. Oh? Ooops! I didn't notice that in this variation. Thanks! If you don't want to customize the RelaxNG and generate a DTD from it, you Sigh. I'd love to customize the RelaxNG and generate a DTD from it, but unfortunately I really don't have the knowledge about how to do that, so I would really appreciate one good example to show me how. I'd like to do things the right way if I could. Do you know of a good step-by-step example of customizing Docbook5 with RelaxNG? ie no hand-waving and the rest is left as an exercise for the reader or implementation is trivial, just a simple example from which I can download the example files, execute commands and have a 90% chance of having the example work out of the box can just edit a copy of the DocBook 5 DTD. Because it is a flat structure with no parameter entities, editing it is straightforward, if sometimes tedious. You need to add your new element as you have, and you also need to edit any content models of elements that are to contain your new element. If you don't do that, then although the element name is valid, there is no place in the document where its position is valid. If I'm understanding you correctly, you mean that I need to put the new element into an appropriate place in the grammar so that there's enough context for the element to be properly processed. Is that right? If so, that makes sense but that generality isn't clear enough to help me at this stage of my understanding. I don't think you want to use ENTITY as the attribute type for server. Such an attribute would contain the name of an unparsed entity declared elsewhere, and I don't see that for server1, server2, etc. I think you want CDATA there. Okay. In your test.xml sample, the elements are not actually in the DocBook namespace. You declare the namespace with a db prefix, but you don't use the prefix. If you declare the namespace without a prefix, then your elements will be in that default namespace. Your app.xsl needs to import the stock docbook stylesheet (perhaps it does and you aren't showing that). Then the template that matches on Docbook elements must have the namespace prefix match=db:app. Then the call-template uses a name of db:prompt, but you don't define a template with that name. Also, it is unusual to define a template name using a namespace prefix. It looks a bit like you are trying to invoke the template that handles the prompt element to handle your app element, but XSLT doesn't work that way. Okay. Wow, this is really frustrating. :( The impression I'm getting is that I need to use XSL-FO to get what I want. Is that right? You might consider dropping back to DocBook4 so you don't have to deal with namespaces at the same time you are figuring other things out. Do you really need DocBook5? E No, I guess not, but isn't Docbook5 supposed to save the universe? :) Quite honestly, LaTeX would be a much faster path for me to getting publication-quality print output (after all, it was generating good stuff for me 15 years ago! :), but there a number of compelling advantages (IMO) to using Docbook. (I think! :) Bob Stayton Sagehill Enterprises DocBook Consulting [EMAIL PROTECTED] - Original Message - From: Kells Kearney [EMAIL PROTECTED] To: docbook@lists.oasis-open.org Sent: Tuesday, March 13, 2007 4:13 PM Subject: [docbook] docbook5 and adding elements (long) I've taken a look through the e-mail archives, and I've tried googling, but I'm unable to find an answer to why I can't do something that should be quite simple. :( I've found documentation for how to do it using Docbook 4.x (and had no luck using it with Docbook 5), but it *seems* like a good thing to do it in Docbook 5. (Right?) I'm hoping that some kind soul can help me understand what it is that I'm doing wrong. I think that all I need is one good example. Thanks in advance! kells What I'm trying to do: I would like to be able to create an application-specific prompt to create documentation for the application. The prompt looks like: app: server_name where I'd like to define server_name in an entity as an attribute with a reasonable default. To illustrate, I'd like to be able to write: app command bleh /command variablecolour/variable=replaceableblue/replaceable /app app server=server2 command bleh /command variablecolour/variable=replaceablegreen/replaceable /app and have the output look something like: app: server1 bleh colour=blue app: server2 bleh colour=green Where I am so far == Input file: test.xml ?xml version=1.0 encoding=UTF-8? !DOCTYPE book SYSTEM app.dtd book
Re: [docbook] docbook5 and adding elements (long)
Hi Kells, The DTD version of DocBook 5 does not have the %local.* parameter entities. All of the customization features are in the RelaxNG version, from which the DTD version is generated. If you don't want to customize the RelaxNG and generate a DTD from it, you can just edit a copy of the DocBook 5 DTD. Because it is a flat structure with no parameter entities, editing it is straightforward, if sometimes tedious. You need to add your new element as you have, and you also need to edit any content models of elements that are to contain your new element. If you don't do that, then although the element name is valid, there is no place in the document where its position is valid. I don't think you want to use ENTITY as the attribute type for server. Such an attribute would contain the name of an unparsed entity declared elsewhere, and I don't see that for server1, server2, etc. I think you want CDATA there. In your test.xml sample, the elements are not actually in the DocBook namespace. You declare the namespace with a db prefix, but you don't use the prefix. If you declare the namespace without a prefix, then your elements will be in that default namespace. Your app.xsl needs to import the stock docbook stylesheet (perhaps it does and you aren't showing that). Then the template that matches on Docbook elements must have the namespace prefix match=db:app. Then the call-template uses a name of db:prompt, but you don't define a template with that name. Also, it is unusual to define a template name using a namespace prefix. It looks a bit like you are trying to invoke the template that handles the prompt element to handle your app element, but XSLT doesn't work that way. You might consider dropping back to DocBook4 so you don't have to deal with namespaces at the same time you are figuring other things out. Do you really need DocBook5? Bob Stayton Sagehill Enterprises DocBook Consulting [EMAIL PROTECTED] - Original Message - From: Kells Kearney [EMAIL PROTECTED] To: docbook@lists.oasis-open.org Sent: Tuesday, March 13, 2007 4:13 PM Subject: [docbook] docbook5 and adding elements (long) I've taken a look through the e-mail archives, and I've tried googling, but I'm unable to find an answer to why I can't do something that should be quite simple. :( I've found documentation for how to do it using Docbook 4.x (and had no luck using it with Docbook 5), but it *seems* like a good thing to do it in Docbook 5. (Right?) I'm hoping that some kind soul can help me understand what it is that I'm doing wrong. I think that all I need is one good example. Thanks in advance! kells What I'm trying to do: I would like to be able to create an application-specific prompt to create documentation for the application. The prompt looks like: app: server_name where I'd like to define server_name in an entity as an attribute with a reasonable default. To illustrate, I'd like to be able to write: app command bleh /command variablecolour/variable=replaceableblue/replaceable /app app server=server2 command bleh /command variablecolour/variable=replaceablegreen/replaceable /app and have the output look something like: app: server1 bleh colour=blue app: server2 bleh colour=green Where I am so far == Input file: test.xml ?xml version=1.0 encoding=UTF-8? !DOCTYPE book SYSTEM app.dtd book version=5.0 xmlns:xlink=http://www.w3.org/1999/xlink; xmlns:xi=http://www.w3.org/2001/XInclude; xmlns:svg=http://www.w3.org/2000/svg; xmlns:mml=http://www.w3.org/1998/Math/MathML; xmlns:html=http://www.w3.org/1999/xhtml; xmlns:db=http://docbook.org/ns/docbook; chapter titleHello world!/title paraSample explanatory text here/para app server=server2 command bleh /command variablecolour/variable=replaceablegreen/replaceable /app /chapter /book My DTD app.dtd: ?xml version=1.0 encoding=UTF-8? !-- Add the app element to something hopefully similar to what I want. :) If I understand things correctly, this inserts the element definition into the right spots in the DocBook grammar (aka DTD). -- !ENTITY % local.tech.char.class |app !-- Other documentation I've seen suggests taking the docbook dtd, making a parameter entity and invoking it here. It goes badly for me if I do !ENTITY % DOCBOOK SYSTEM file://c:/docbook/lib/docbook-50b5/dtd/docbook.dtd %DOCBOOK; So I can't use the above. Right? -- !-- Create the app element -- !ELEMENT app (#PCDATA|filename|replaceable|constant|parameter)* !-- Set a default server name -- !ATTLIST app server ENTITY server1 My app.xsl -- ?xml version=1.0 encoding=UTF-8? xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform; xmlns:fo=http://www.w3.org/1999/XSL/Format;
Re: [docbook] docbook5 and adding elements (long)
Okay, I've given Relax NG a try, and I'm stumped with it too. I've started with the assembly-language example that has been pointed out to me, and it seems to be promising. I'm still missing a step, so a correction would be most welcome! :) Here's a sample session with error message that I'm getting: C:\kells\docbook1\assembly_examplecreate_pdf.bat C:\kells\docbook1\assembly_examplejava -jar c:\docbook\bin\trang.jar asmbook.rn c asmbook.rng C:\kells\docbook1\assembly_examplexsltproc -o asmbook.xsl rng2customization.xsl asmbook.rng docbook.rng C:\kells\docbook1\assembly_examplexsltproc -o asmbook.fo asm_db.xsl asmbook.xml WARNING: cannot add @xml:base to node set root element. Relative paths may not work. Making portrait pages on USletter paper (8.5inx11in) register encountered in para, but no template matches. register encountered in para, but no template matches. register encountered in para, but no template matches. instruction encountered in para, but no template matches. asmbook.xml == ?xml version=1.0 encoding=UTF-8? article xmlns=http://docbook.org/ns/docbook; version=5.0 titleAssembler guide/title pararegisterAX/register is 16bit register. You can use registers registerAH/register and registerAL/register to access its higher and lower parts. instructionMOV/instruction is instruction for moving data between your registers and memory./para /article asmbook.rnc (modified with my local docbook.rnc file) default namespace = http://docbook.org/ns/docbook; namespace db = http://docbook.org/ns/docbook; namespace r = http://nwalsh.com/xmlns/schema-remap/; # new element for CPU registers db.register = [ r:remap [ db:emphasis [ role = bold ] ] ] element register { text } # new element for instructions db.instruction = [ r:remap [ db:code [ ] ] ] element instruction { text } # combined pattern asm.inlines = db.register | db.instruction include file:///c:/docbook/lib/docbook-5.0b5/rng/docbook.rnc { # register and instruction are permitted everywhere in inline content db.general.inlines |= asm.inlines } rng2customization.xsl (Can this be replaced with something more automagic?) = ?xml version=1.0 encoding=utf-8? xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform; xmlns:xslo=http://www.w3.org/1999/XSL/TransformAlias; xmlns:r=http://nwalsh.com/xmlns/schema-remap/; xmlns:rng=http://relaxng.org/ns/structure/1.0; xmlns:exsl=http://exslt.org/common; extension-element-prefixes=exsl exclude-result-prefixes=exsl rng r version=1.0 xsl:output indent=yes/ xsl:namespace-alias stylesheet-prefix=xslo result-prefix=xsl/ xsl:template match=/ xslo:stylesheet version=1.0 xsl:attribute name=exsl:dummy xmlns:exsl=http://exslt.org/common;dummy/xsl:attribute xslo:template match=/ mode=stripNS xslo:variable name=unspecialized xslo:apply-templates mode=remap/ /xslo:variable xslo:apply-templates select=exsl:node-set($unspecialized)/node() mode=stripNS/ /xslo:template xsl:for-each select=//rng:element[r:remap] xslo:template match=*[local-name() = '[EMAIL PROTECTED]'][namespace-uri() = '{//ancestor-or-self::[EMAIL PROTECTED]/@ns}'] mode=remap xsl:choose xsl:when test=r:remap//r:content xsl:apply-templates select=r:remap/node() mode=copy/ /xsl:when xsl:otherwise xsl:element name={local-name(r:remap/*[1])} namespace={namespace-uri(r:remap/*[1])} xsl:copy-of select=r:remap/*[1]/@*/ xslo:apply-templates mode=remap/ /xsl:element /xsl:otherwise /xsl:choose /xslo:template /xsl:for-each xslo:template match=node()|@* mode=remap xslo:copy xslo:apply-templates select=node()|@* mode=remap/ /xslo:copy /xslo:template /xslo:stylesheet /xsl:template xsl:template match=node()|@* mode=copy xsl:copy xsl:apply-templates select=node()|@* mode=copy/ /xsl:copy /xsl:template xsl:template match=r:content mode=copy xslo:apply-templates mode=remap/ /xsl:template /xsl:stylesheet asm_db.xsl (to tie together the docbook.rng and asmbook.rng) == ?xml version=1.0 encoding=utf-8? xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform; version=1.0 xsl:import href=file:///c:/docbook/lib/docbook5-xsl-1.72.0/fo/profile-docbook.xsl/ xsl:import href=file:///c:/kells/docbook1/assembly_example/asmbook.xsl/ /xsl:stylesheet create_pdf.bat == java -jar c:\docbook\bin\trang.jar asmbook.rnc asmbook.rng xsltproc -o asmbook.xsl rng2customization.xsl asmbook.rng docbook.rng xsltproc -o asmbook.fo asm_db.xsl asmbook.xml On 3/13/07, Dick Hamilton [EMAIL PROTECTED] wrote: Kells, I haven't worked with the DTD for DocBook 5, just the Relax NG
RE: [docbook] docbook5 and adding elements (long)
Kells, I haven't worked with the DTD for DocBook 5, just the Relax NG schema, so I can't help with the specific problem you're having. With any luck someone will post a quick fix. But, if you can work with the Relax NG schema version of DocBook, here are a couple of resources that should be helpful: http://www.docbook.org/docs/howto/ This guide has a section about customizing the DocBook 5 Relax NG schema. The following reference discusses customizing DocBook 5 stylesheets once you've modified a schema: http://xmlguru.cz/2006/03/easy-docbook-specialization It also points to an article by Norm Walsh that may be helpful. I suspect that the combination of these references will get you where you need to go if you can use Relax NG instead of DTDs. Good luck. Dick Hamilton [EMAIL PROTECTED] -Original Message- From: Kells Kearney [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 13, 2007 6:13 PM To: docbook@lists.oasis-open.org Subject: [docbook] docbook5 and adding elements (long) I've taken a look through the e-mail archives, and I've tried googling, but I'm unable to find an answer to why I can't do something that should be quite simple. :( I've found documentation for how to do it using Docbook 4.x (and had no luck using it with Docbook 5), but it *seems* like a good thing to do it in Docbook 5. (Right?) I'm hoping that some kind soul can help me understand what it is that I'm doing wrong. I think that all I need is one good example. Thanks in advance! kells What I'm trying to do: I would like to be able to create an application-specific prompt to create documentation for the application. The prompt looks like: app: server_name where I'd like to define server_name in an entity as an attribute with a reasonable default. To illustrate, I'd like to be able to write: app command bleh /command variablecolour/variable=replaceableblue/replaceable /app app server=server2 command bleh /command variablecolour/variable=replaceablegreen/replaceable /app and have the output look something like: app: server1 bleh colour=blue app: server2 bleh colour=green Where I am so far == Input file: test.xml ?xml version=1.0 encoding=UTF-8? !DOCTYPE book SYSTEM app.dtd book version=5.0 xmlns:xlink=http://www.w3.org/1999/xlink; xmlns:xi=http://www.w3.org/2001/XInclude; xmlns:svg=http://www.w3.org/2000/svg; xmlns:mml=http://www.w3.org/1998/Math/MathML; xmlns:html=http://www.w3.org/1999/xhtml; xmlns:db=http://docbook.org/ns/docbook; chapter titleHello world!/title paraSample explanatory text here/para app server=server2 command bleh /command variablecolour/variable=replaceablegreen/replaceable /app /chapter /book My DTD app.dtd: ?xml version=1.0 encoding=UTF-8? !-- Add the app element to something hopefully similar to what I want. :) If I understand things correctly, this inserts the element definition into the right spots in the DocBook grammar (aka DTD). -- !ENTITY % local.tech.char.class |app !-- Other documentation I've seen suggests taking the docbook dtd, making a parameter entity and invoking it here. It goes badly for me if I do !ENTITY % DOCBOOK SYSTEM file://c:/docbook/lib/docbook- 50b5/dtd/docbook.dtd %DOCBOOK; So I can't use the above. Right? -- !-- Create the app element -- !ELEMENT app (#PCDATA|filename|replaceable|constant|parameter)* !-- Set a default server name -- !ATTLIST app server ENTITY server1 My app.xsl -- ?xml version=1.0 encoding=UTF-8? xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform; xmlns:fo=http://www.w3.org/1999/XSL/Format; xmlns:db=http://docbook.org/ns/docbook; !-- Here's where it starts to get really scary for me. :) This is also wrong, but I *think* shows what I want to do. -- xsl:template match=app xsl:call-template name=db:prompt xsl:value-of select=@server / /xsl:call-template amp; xsl:apply-templates select=. / /xsl:template /xsl:stylesheet Invocation with xsltproc == xsltproc --nonet --xinclude --output test.fo app.xsl test.xml - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]