Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
I'm authoring API user documentation using GitHub pages (adocs) and need to include HTML content that is dynamically rendered from XML source docs located within the GitHub repository. This technique will ensure that the document content is always current - it auto-generates whenever the Developer updates the XML source code. Is there a way to use a passthrough block or other technique to make this reality?
For reference, the following code is how I currently render the XML in an HTML document. Not sure if this is applicable, but the xsl document parses the XML file and transforms the data into an HTML table and then displays it in a browser. <!DOCTYPE html> <html> <head> … </head> <body> <div class="content"> <script language="javascript"> // Load XML var xml = new ActiveXObject("Microsoft.XMLDOM") xml.async = false xml.load("fieldParams/ReqParams.xml") // Load the XSL var xsl = new ActiveXObject("Microsoft.XMLDOM") xsl.async = false xsl.load("xsl.xsl") // Transform document.write(xml.transformNode(xsl)) </script></div> </body> </html> |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Administrator
|
@RickEEE, You bet there is! What you're looking for is, sure enough, is a passthrough block. A passthrough block passes content directly through to the output without doing any processing on it. Here's an example: ++++ <script language="javascript">
// Load XML
var xml = new ActiveXObject("Microsoft.XMLDOM")
xml.async = false
xml.load("fieldParams/ReqParams.xml")
// Load the XSL
var xsl = new ActiveXObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load("xsl.xsl")
// Transform
document.write(xml.transformNode(xsl))
</script> ++++ (a passthrough block also accepts a custom list of subs, such as subs=attributes) However, generally it's not a good idea to mix content and presentation / behavior. A better way of accomplishing a similar result without having to clutter up your content document is the docinfo feature. Just drop the script tag into a file named docinfo-footer.html: <script language="javascript"> // Load XML var xml = new ActiveXObject("Microsoft.XMLDOM") xml.async = false xml.load("fieldParams/ReqParams.xml") // Load the XSL var xsl = new ActiveXObject("Microsoft.XMLDOM") xsl.async = false xsl.load("xsl.xsl") // Transform document.write(xml.transformNode(xsl)) </script> Then activate it when calling Asciidoctor using -a docinfo=shared-footer or add :docinfo: shared-footer to the document header. It's also possible to introduce docinfo content using the docinfo extension point. Cheers, -Dan On Mon, Feb 18, 2019 at 2:15 PM RickEEE [via Asciidoctor :: Discussion] <[hidden email]> wrote: I'm authoring API user documentation using GitHub pages (adocs) and need to include HTML content that is dynamically rendered from XML source docs located within the GitHub repository. This technique will ensure that the document content is always current - it auto-generates whenever the Developer updates the XML source code. Is there a way to use a passthrough block or other technique to make this reality? ... [show rest of quote] -- Dan Allen | @mojavelinux | https://twitter.com/mojavelinux |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Sincere, Thank you, Dan. I did not realize it would be that simple. Keep up the great work.
|
Free forum by Nabble | Edit this page |