RE: [xsl] Requested review, xml 2 js xslt

Subject: RE: [xsl] Requested review, xml 2 js xslt
From: "Robert Koberg" <rob@xxxxxxxxxx>
Date: Fri, 18 Oct 2002 07:32:04 -0700
Hi Nate,

I would try a transform that brings the nav XMLs together into one uniform
hierarchical structure. Then run through it and create JS objects for your nodes
instead of long arrays. Something like:

// create hierarchy in reverse order so the
// objects exist to be included in their parent

..snip..

var f1_obj = new Object();
f1_obj.display_label_link = "false";
f1_obj.expand = "false";
f1_obj.id = "f1";
f1_obj.index_page = "siteindex";
f1_obj.label = "Home";
f1_obj.name = "en_us";
f1_obj.pager = "true";
f1_obj.snailtrail = "false";
f1_obj.status = "editorial";
f1_obj.xsl_fileref = "basic_3col.xsl";
f1_obj.nav_state = 1;
f1_obj.parent = 'site_obj';
f1_obj.folders = [f953036460_obj,f661058541_obj,jobs1_obj,faq_obj,base_obj];
f1_obj.pages = [siteindex_obj,p353715906_obj,p523744271_obj];
f1_obj.rightcol = [c413186147_obj];
f1_obj.content =
[cindex_obj,c1919458443_obj,c413186147_obj,c531371071_obj,c1021039099_obj];

var site_obj = new Object();
site_obj.id = "clean2";
site_obj.nav_col = "tabs_narrow_left";
site_obj.p_nam = "label";
site_obj.site_index = "siteindex";
site_obj.subtitle = "Storyboard";
site_obj.title = "Clean Site";
site_obj.use_tool_style = "1";
site_obj.folders = [f1_obj];

Once you have an hierarchical object representation you can use any number of
free JS scripts/objects that are freely available. I have an example of this if
you want.

Another interesting project you can do with this type of thing is apply a
similar XSL against your schema to help with schema-driven, browser-based
editing. :)

best,
-Rob


> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Nathan Shaw
> Sent: Friday, October 18, 2002 6:45 AM
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Cc: Joerg Heinicke
> Subject: Re: [xsl] Requested review, xml 2 js xslt
>
>
> After some good advice from Jeorg, I am re-submitting
> my question on my xml 2 js xslt.
>
> Basically, what I am doing is generating a js array
> file that is included to provide the navigation menu
> items for a drop-down menu (Hiermenus).
>
> I chose to create a near-empty xml file (only contains
> a <Root></Root> element) to parse and include 4
> separate files that hold navigation information,
> instead of actually parsing one of those files and
> including the other 3. It just seemed cleaner to me to
> do it that way, because one of the nav xml files
> (news) is completely different from the other 3.
> However, as this is my first stab at generating a js
> file and the method I have chosen seems a bit odd, I
> would love to get some comments on it.
>
> I have pasted the relevant pieces of my xslt below and
> would appreciate comments, critiques, etc.. on it.
>
> TIA --Nate
>



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread