[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [dita-lightweight-dita] Request for exemplar templates
Thank you, Michael. The pointer helped me, and at this point, I'd
say it is good enough considering that we may be modifying the
"spec" considerably as things progress. I took a shot at an XSLT based discombobulator and have some initial thoughts: There are a range of possible implementations to consider. The ultimate might be a DITA-aware DTD in respecializable syntax, but the minimum might well be simply an identity transform that strips out the hints for a result that is ready for use as a field-based form. I consider both those examples to be illustrative endpoints, but: a) we need to decide if there are any in-between use cases that are goals for this group (I can imagine an editor driven solely by Schematron rules that enshrine the template's intent, for example), b) we need a story about how such a template can be created in the first case (e.g., with a validating editor I can create an Erik Hennum-style "specialization by example" -- http://svdig.ditamap.com/SpecializationWhyWhenHow.ppt). That process is not possible with Michael's template which contains special attributes. Phase 1: Use an identity transform to parse the template into a web-based form using contentEditable sections. This is eminently doable and gets the resulting implementation into a useful form in the fastest manner. Phase 2: Allocate some time to explore how far we can go with an XSLT-based analyzer. This could be open-ended which is why I think we need a way to budget the time and at least come away with recommendations. The difficulty lies in using XSLT for pure algorithmic function, not simply as a transform. XSLT 2.0 and 3.0 offer increasing capability here (some examples: http://www.saxonica.com/papers/ideadb-1.1/mhk-paper.xml). Phase 3: Allocate some time to explore developing a separate parser in the programming language that will be used for the other algorithmic function. We'd be trading "easy to parse; hard to compute" for "hard to parse; easy to compute" as it were. I don't know if one is better than the other; it may be a case of which skills one is most productive with. Yes, let's set up a Git home at OASIS. I'd like to ask someone's help with this. And to seed it, attached are the quasi-Phase 2 starter files I've worked with. All I did was make the template to be well-formed xml and extended an identity transform to get to where I could see the flat decomposition of all the node types (see the HTML result, where the numerics inside the square brackets indicate the string length so that I could see "whitespace" contributions to the view). From this one would have to count occurrences, capture nesting relationships, etc. to build up a text-based DTD-like output rendition of the model (not a transformation, per se). I added my PHP-based transform "ANT" file--you can use your preferred approach from here on. Ask me offline if you want a how-to, which was not my intent in this note. I will turn my own work to the Phase 1 approach since I'm much closer to having that as a working demo in the application that spawned the template suggestion. Phase 3 (if someone wants to try it) could be implemented in one's favorite language. I have a very simple state machine pseudocode for parsing the well-formed XML syntax that you can implement in Python, Java, whatever; the rest of the algorithm follows the Phase 2 approach. Hoping this helps kick things off. --
Don R. Day
Founding Chair, OASIS DITA Technical Committee LinkedIn: donrday Twitter: @donrday About.me: Don R. Day Skype: don.r.day
"Where is the wisdom we have lost in knowledge?
Where is the knowledge we have lost in information?" --T.S. Eliot On 2/5/2016 12:45 PM, Michael Priestley
wrote:
Hi Don,
|
<topic id="termdef_term" outputclass="tlotermtopic"> <title outputclass="tloterm">Structured Content</title> <prolog outputclass="tlotermprolog"> <data outputclass="tlotermauthor" specrole="prompt">author name here</data> <specmeta> <ph outputclass="tlophrase" specrole="doc">A new global phrase element</ph> <data outputclass="tlodata" specmodel="choice" specrole="modelonly"> Simple text only for this global data specialization, but with a different specmodel you could do anything </data> <specatt outputclass="tloatt" specrole="doc"> A conditional processing attribute called tloatt </specatt> </specmeta> </prolog> <body outputclass="tlotermbody" specmodel="sequence"> <section outputclass="tlowhat"> <title specrole="generate">What is it?</title> <p>...</p> </section> <section outputclass="tlowhy"> <title specrole="generate">Why is it important?</title> <p>...</p> </section> <section outputclass="tloessay"> <title specrole="generate">Why does a technical writer need to know this?</title> <p>...</p> </section> <section outputclass="tlosummary" collection-type="sequence"> <title specrole="generate">Summary:</title> <p>text node with <ph>allowed</ph> phrase.</p> </section> <section conref="task-spec.dita/task-def/postreqs"/> </body> </topic>
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:php="http://php.net/xsl" > <!-- http://markmail.org/message/pd4u5kfg44xp5x5c --> <xml:strip-space elements="*"/> <!-- must be 'xml' to create well-formed input to transforms. --> <xsl:output method="xml" indent="no" /> <xsl:template match="/"> <ul> <xsl:apply-templates/> </ul> </xsl:template> <xsl:template match="*"> <li> <xsl:if test="not(name(.) = '')"> <b><xsl:value-of select="name(.)"/></b> </xsl:if> <xsl:apply-templates/> </li> </xsl:template> <xsl:template match="@*"> <xsl:value-of select="local-name()" />='<xsl:value-of select="." />'<br/> </xsl:template> <xsl:template match="text()"> <xsl:if test="not(string-length(.) = 0)"> [<xsl:value-of select="string-length(.)"/>:<xsl:value-of select="." />] </xsl:if> </xsl:template> </xsl:stylesheet> <!-- <xsl:foreach select="node()"> <xsl:choose> <xsl:when test="child::*"> <ul> <xsl:apply-templates select="node()" /> </ul> </xsl:when> <xsl:when test="text()"> <xsl:apply-templates select="." /> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="node()" /> </xsl:otherwise> </xsl:choose> </xsl:foreach> -->
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]