|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
hr separator? insert external HTML code?Is there a direct way you can insert a separator (i.e., like the <hr
tag) into the HTML output? While doing research into that question, I notice that the XSL book mentions a way to insert external HTML code into the page content (i.e., not the footer or header) http://www.sagehill.net/docbookxsl/InsertExtHtml.html#CodeInPage I'm not quite sure I understand the directions here and the example. Is it not enough just to add the code </para> <?dbhtml-include href="mycode.html"?> <para> ... in the appropriate place? (I'm assuming no). To use a trivial example: Suppose mycode.html contained only: <hr /> Would that be sufficient or would I need to wrap it inside html. i.e., <html> <hr /> </html> Judging from the context, I'm guessing that I would need to create/modify a template. Can you confirm this? The XSL example given for customizing the header is: <xsl:template name="user.header.content"> <xsl:variable name="codefile" select="document('mycode.html',/)"/> <xsl:copy-of select="$codefile/htmlcode/node()"/> </xsl:template> However, that refers to a specific template called user.header.content (which is already part of the docbook xsl sheets). In my trivial example of inserting the hr tag via mycode.html, would I need to invent a template name out of thin air? Or use an existing one? If a template is required, can you point me to an example of how to accomplish this? (Again, I realize that using a dbhtml-include statement simply to insert an hr tag is trivial, but is useful for instructive purposes). Thanks. -- Robert Nagle htpt://www.robertnagle.info --------------------------------------------------------------------- To unsubscribe, e-mail: docbook-apps-unsubscribe@... For additional commands, e-mail: docbook-apps-help@... |
|
|
Re: hr separator? insert external HTML code?Hi Robert,
My answers are below. Bob Stayton Sagehill Enterprises bobs@... ----- Original Message ----- From: "Robert Nagle" <idiotprogrammer@...> To: <docbook-apps@...> Sent: Wednesday, October 14, 2009 3:11 AM Subject: [docbook-apps] hr separator? insert external HTML code? > Is there a direct way you can insert a separator (i.e., like the <hr > tag) into the HTML output? > > While doing research into that question, I notice that the XSL book > mentions a way to insert external HTML code into the page content > (i.e., not the footer or header) > http://www.sagehill.net/docbookxsl/InsertExtHtml.html#CodeInPage > > I'm not quite sure I understand the directions here and the example. > > Is it not enough just to add the code > </para> > <?dbhtml-include href="mycode.html"?> > <para> > ... > in the appropriate place? (I'm assuming no). Yes, that is sufficient, as long as mycode.html contains a well-formed XML document. > To use a trivial example: Suppose mycode.html contained only: > > <hr /> > > Would that be sufficient or would I need to wrap it inside html. i.e., > <html> > <hr /> > </html> Either way works. The external file must be a well-formed XML file or it will generate an error when it is opened by the XSLT document() function that the processing instruction template employs. If you want to include a well-formed XML element, then you don't need the <html> wrapper. However, if you want to include a sequence of elements, a sequence does not constitute a well-formed document. So wrap the sequence in <html></html>, and the stylesheet will strip off the wrapper and use the sequence. It only does that if the root element is <html>. > Judging from the context, I'm guessing that I would need to > create/modify a template. Can you confirm this? No, this feature is already available in the stylesheet. > The XSL example given for customizing the header is: > > <xsl:template name="user.header.content"> > <xsl:variable name="codefile" select="document('mycode.html',/)"/> > <xsl:copy-of select="$codefile/htmlcode/node()"/> > </xsl:template> > > However, that refers to a specific template called user.header.content > (which is already part of the docbook xsl sheets). The user.header.content template is a placeholder template in the stylesheets. You are just customizing it to do something useful. See: http://www.sagehill.net/docbookxsl/EmptyTemplates.html > In my trivial example of inserting the hr tag via mycode.html, would > I need to invent a template name out of thin air? Or use an existing > one? > > If a template is required, can you point me to an example of how to > accomplish this? A new template is not required. > (Again, I realize that using a dbhtml-include statement simply to > insert an hr tag is trivial, but is useful for instructive purposes). Understood. Let me know if it doesn't work for you. --------------------------------------------------------------------- To unsubscribe, e-mail: docbook-apps-unsubscribe@... For additional commands, e-mail: docbook-apps-help@... |
|
|
Re: hr separator? insert external HTML code?This is very interesting and reveals another problem with my XSLT processing.
I receive this error message [Saxon6.5.5] ERROR: dbhtml-include processing instruction href has no content. [Saxon6.5.5] Writing OEBPS/nt001.html for chapter(nt001) Here is what I have in nt001.xml file. .... <para>test </para> <?dbhtml-include href="fragment1.html"?> <para>test over </para> fragment1.html exists in the same directory as the other xml files and contains <html> <p><strong> Hello! Hello! Hello! </strong> </p> <hr /> </html> The instructions seem straightforward enough. Do I need to enable a parameter or is there something wrong with my Saxon processor on Oxygen 11? (docbook xsl 1.75.2 ) (btw, I'm going to start a new thread in a few seconds about a related matter). Robert On Wed, Oct 14, 2009 at 12:23 PM, Bob Stayton <bobs@...> wrote: > Hi Robert, > My answers are below. > > Bob Stayton > Sagehill Enterprises > bobs@... > > > ----- Original Message ----- From: "Robert Nagle" > <idiotprogrammer@...> > To: <docbook-apps@...> > Sent: Wednesday, October 14, 2009 3:11 AM > Subject: [docbook-apps] hr separator? insert external HTML code? > > >> Is there a direct way you can insert a separator (i.e., like the <hr >> tag) into the HTML output? >> >> While doing research into that question, I notice that the XSL book >> mentions a way to insert external HTML code into the page content >> (i.e., not the footer or header) >> http://www.sagehill.net/docbookxsl/InsertExtHtml.html#CodeInPage >> >> I'm not quite sure I understand the directions here and the example. >> >> Is it not enough just to add the code >> </para> >> <?dbhtml-include href="mycode.html"?> >> <para> >> ... >> in the appropriate place? (I'm assuming no). > > Yes, that is sufficient, as long as mycode.html contains a well-formed XML > document. > >> To use a trivial example: Suppose mycode.html contained only: >> >> <hr /> >> >> Would that be sufficient or would I need to wrap it inside html. i.e., >> <html> >> <hr /> >> </html> > > Either way works. The external file must be a well-formed XML file or it > will generate an error when it is opened by the XSLT document() function > that the processing instruction template employs. If you want to include a > well-formed XML element, then you don't need the <html> wrapper. However, > if you want to include a sequence of elements, a sequence does not > constitute a well-formed document. So wrap the sequence in <html></html>, > and the stylesheet will strip off the wrapper and use the sequence. It only > does that if the root element is <html>. > >> Judging from the context, I'm guessing that I would need to >> create/modify a template. Can you confirm this? > > No, this feature is already available in the stylesheet. > >> The XSL example given for customizing the header is: >> >> <xsl:template name="user.header.content"> >> <xsl:variable name="codefile" select="document('mycode.html',/)"/> >> <xsl:copy-of select="$codefile/htmlcode/node()"/> >> </xsl:template> >> >> However, that refers to a specific template called user.header.content >> (which is already part of the docbook xsl sheets). > > The user.header.content template is a placeholder template in the > stylesheets. You are just customizing it to do something useful. See: > > http://www.sagehill.net/docbookxsl/EmptyTemplates.html > >> In my trivial example of inserting the hr tag via mycode.html, would >> I need to invent a template name out of thin air? Or use an existing >> one? >> >> If a template is required, can you point me to an example of how to >> accomplish this? > > A new template is not required. > >> (Again, I realize that using a dbhtml-include statement simply to >> insert an hr tag is trivial, but is useful for instructive purposes). > > Understood. Let me know if it doesn't work for you. > > --------------------------------------------------------------------- To unsubscribe, e-mail: docbook-apps-unsubscribe@... For additional commands, e-mail: docbook-apps-help@... |
| Free embeddable forum powered by Nabble | Forum Help |