Transforming XML to HTML on the fly, and adding JavaScript events? -
i'm running django site xml text stored in textfield
properties. it's stored xml rather plain text because it's heavily annotated information underlying manuscript, such abbreviations , symbols. here's example:
class entry(models.model): # name , description. chapter = models.foreignkey(chapter) latin_text = models.textfield()
here's example of content of latin_text
:
<initial type="2">i</initial>n <place type="0"><span>ricmond</span></place> ten<abbr type="1">et</abbr> aeccl<abbr type="0">esi</abbr>a de cietriz .ii. hid<abbr type="0">as</abbr>.
i'd start displaying xml text on html pages.
i know can display raw xml dropping textarea
: issue i'd display in more beautiful way, with:
- styling (all
abbr
elements in italics,place
element in bold) - javascript events let user explore abbreviations (when user mouses on
abbr
orplace
, show pop-up explanation)
i'm not sure if xslt can need, or if can used alongside html. question is:
- should transform xml html before adding django database?
- or can rendering need on fly xslt or javascript?
i use xslt transform , attach events programmatically javascript. data , converting before hand prevents interpreting in different way later. html should layout , separate data. translate javascript intensive on client. xslt , css cleaner , attaching events in js lightweight.
not familiar django maybe check answer out : can use xslt in django?
Comments
Post a Comment