15 Replies Latest reply on Feb 19, 2008 4:21 AM by (Rosta_Vanek)

    ANN: Indesign CS3 JS help to HTML using XSLT

    [Jongware] Most Valuable Participant
      I felt quite at home with the previous CS's JS Help PDFs, but I'm not too wild about the ExtendScript editor. But if you don't use that, you miss out the online help! Fortunately, in one of the ExtendScript subfolders you can find an XML document with the slightly bizarre name "omv$indesign-5.0-en_us.xml". This contains the entire help document, in handy XML format.

      As an exercise, I wrote an extensive XSL stylesheet to convert it to fully cross-referenced HTML. This script is a bit too long to include here, but you can d/l it at http://www.jongware.com/binaries/indesign.xsl.

      Run it through your favourite XSL processor, and you get the whole thing in one huge file. Alternatively, you can select either a single class or enumeration (such as "TextFrame") or a single alphabetic letter ("A", just to provide an example, will process all classes and enums from "AlignDistributePreference" to "AutoEnum"). In these cases, the hyperlinks will (obviously/unfortunately) fail.

      It is quite possible to load the 113,000 line XML into InDesign and apply formatting to it, but I think I'll leave it at this.
        • 1. Re: ANN: Indesign CS3 JS help to HTML using XSLT
          Level 1
          Hi jongware,

          Great stuff! I have an XSL template of my own that I used for testing conversion to HTML, and one that converts to InDesign tagged text (which I used to create the PDFs we used to publish), but it's great to have more ways of looking at the model.

          Thanks for sharing this with the community!

          Ole
          • 2. Re: ANN: Indesign CS3 JS help to HTML using XSLT
            [Jongware] Most Valuable Participant
            Hi Ole!

            Well I could have known... You *really* should have added hyperlinks to the PDFs!

            I noticed I forgot to add "Array of" to some values--fixed it now. Oh, and if the string version of a constant displays a hyphen (-), don't use it--use the number instead :) My display is kind of a programmer's trick.
            • 3. Re: ANN: Indesign CS3 JS help to HTML using XSLT
              Level 1
              Hi jongware,

              I agree, I *should* have added hyperlinks (apart from the bookmarks, which I did add).

              But...when you multiply 5 (largish) object models (InDesign, InDesign J, InCopy, InCopy J, and InDesign Server) by three programming languages (AppleScript, JavaScript, VBScript) by three human languages (English, French, and Japanese), just getting the PDFs made at all becomes a pretty big deal.

              It took literally years of political struggle to get the object model viewer into the ESTK--but once it was there, I didn't need to create the PDFs anymore. Which, I think, led to an improved Scripting Guide, sample scripts, and other good things. Part of the idea of making the viewer read an XML file was that people could make their own version of the viewer. Which you've done!:-)

              One thing I have in not-ready-for-prime-time form is an XSL template that converts the XML into an SVG block diagram of whatever part of the model you're interested in. I would really like to get the time to finish that. But I have a fairly long list of other things I want to do!

              Thanks,

              Ole
              • 4. Re: ANN: Indesign CS3 JS help to HTML using XSLT
                [Jongware] Most Valuable Participant
                I sure had fun 'tokenizing' the "Can accept: xx, yy or zz" remarks for the "any" value into separate entries :) Only for Properties, though, since with most of the Methods you changed the wording. Please, for the next version, a list of these possible elements in the XML!

                Some new items added: a full index (only if you check it in the XSL--it's quite long); more importantly, per class a list of "Element of", "Returned by", and "Used in", all hyperlinked to the extreme -- now you can see at a glance how all elements link together! These lists are not entirely complete (that's your (Ole's) fault, because of that "any" notation).

                [PS: there seem to be no explanation of function return values...]

                I understand the idea of the SVG block diagrams, and if I feel the urge (and have an example of what it should look like) I might give that a try -- just for laffs. In the mean time I'm finally gonna upgrade my CS1/2 scripts, using my own HTML to guide me :)

                For the XSLT impaired amongst us, d/l the complete HTML page at jongware.com: indesign.zip (3.5MB, zipped to 471Kb). Enjoy!
                • 5. Re: ANN: Indesign CS3 JS help to HTML using XSLT
                  Level 1
                  Hi jongware,

                  re: "...that's your (Ole's) fault, because of that "any" notation..."

                  Not...totally. The object model is actually generated by InDesign's plug-ins as they register their scripting support during the application's start-up. "Any" is just what the ESTK's object model viewer happened to choose as its way of representing multiple possible data types. I only get to edit the stuff in the description field. I agree that "any" isn't the right thing to say, and we'll try to get it fixed.

                  Anyway, the good news is that we were able to make an editing pass through the descriptions this time around, so they've improved somewhat--and that's for all languages, not just JavaScript.

                  By the way, it's important to note that the object model is dynamic. Add or remove plug-ins, and the model will change (and a new XML file will get written).

                  Thanks,

                  Ole
                  • 6. Re: ANN: Indesign CS3 JS help to HTML using XSLT
                    [Jongware] Most Valuable Participant
                    Hi Ole (and other scripting fans)

                    >By the way, it's important to note that the object model is dynamic. Add or remove plug-ins, and the model will change (and a new XML file will get written).

                    That is great! So I just have to regenerate my stuff, should need arise. Pity I can't locate the xmls for Photoshop et al -- any pointers?

                    In the mean time, I decided the *huge* HTML was just a bit unwieldy, so I got xsl:result-document to work. Result? A lot of documents :)

                    The entire help suite can be found under separately). You WILL need an XSLT 2.0 compliant processor; I used Saxon 8 for this one.

                    Enjoy!

                    [Jongware]
                    • 7. Re: ANN: Indesign CS3 JS help to HTML using XSLT
                      Harbs. Level 6
                      Olav_Kvern@adobeforums.com wrote:
                      > By the way, it's important to note that the object model is dynamic. Add or remove plug-ins, and the model will change (and a new XML file will get written).
                      >
                      Yes. I've noticed that. Great stuff!

                      Harbs
                      • 8. Re: ANN: Indesign CS3 JS help to HTML using XSLT
                        Level 1
                        Hi Harbs, [Jongware],

                        The dynamic model also means that if third party plug-ins implement scripting the way we (politely) ask them to, the object, properties, and methods they expose will appear in the model as first-class (so to speak) citizens. This also means that data they add to the model will be preserved in INX and snippets (both of which are built on scripting).

                        It's so cool.

                        Thanks,

                        Ole
                        • 9. Re: ANN: Indesign CS3 JS help to HTML using XSLT
                          Harbs. Level 6
                          Olav_Kvern@adobeforums.com wrote:
                          > This also means that data they add to the model will be preserved in INX and snippets (both of which are built on scripting).
                          >
                          Very good to know!

                          Thanks.
                          • 10. Re: ANN: Indesign CS3 JS help to HTML using XSLT
                            Level 1
                            Hi Jongware,

                            I stumbled upon this excellent piece of work this afternoon while trying to find my own expansion of the InDesign CS3 enumerations. Very nice indeed! Thank you very much.

                            Dave
                            • 11. Re: ANN: Indesign CS3 JS help to HTML using XSLT
                              D Zurn Level 1
                              Thanks to Jongware for making this available. I never knew if I was missing the Javascript reference PDF for CS3 or if it was never made.

                              Good to find out that this ZIP archive has the necessary information for this. I appreciate it, thanks for the great work.

                              Moderators, please consider making this a permanent post!
                              • 12. Re: ANN: Indesign CS3 JS help to HTML using XSLT
                                [Jongware] Most Valuable Participant
                                Thanks guys, for the praise on my hard work :-)

                                Note that all information in the HTML can also be found in the ExtendScript editor (in fact, it's the other way around, and the ESTK is "hot" -- it adds new objects for plugins dynamically).

                                Still, the XSLT can be used for a variety of special purposes. For example, Dave, with a little deft re-writing, can output all or a selection of enumerations in handy HTML format.

                                Ole noted he didn't have the inclination to create a fully cross-referenced PDF for CS3. That might be a project for someone with some time on his/her hands. It sounds easy; re-write the style sheet to output InDesign interchange format, rather than HTML, and load in ID. Done. (At least the basic principle sounds easy!)

                                If this thread would be made "sticky", does that mean I have to provide the zip file for some undefinite time on my site? It is rather a hefty download; my provider does not provide any download details *at all*, so I don't even know how popular it is.
                                • 13. Re: ANN: Indesign CS3 JS help to HTML using XSLT
                                  Level 1
                                  hallo jongware

                                  one good fellow pointed me from this thread of mine:

                                  http://www.adobeforums.com/webx/.3bbf275d.3c062852/2

                                  to your excellent object model HTML particullary this version:
                                  http://www.jongware.com/binaries/indesigncs3jshelp.zip

                                  my XML and HTML skills are zero so i really appreciate somebody did the job of creating hyperlinked HTML WHICH I LOVE

                                  i only have few sugesstions to make this object model dictionary THE STANDARD REFERENCE for CS3 :)))

                                  iam i right that if i click through:

                                  Basic Suite / Application /

                                  i see this exemplary entry:

                                  activeWindow | any | r/w | The front-most window. Can return: Window, LayoutWindow or StoryWindow.

                                  would it be possible to make "Window" "LayoutWindow" "StoryWindow" in the description text clickable hyperlinks to respective entries...

                                  this level of hyperlink structure is missing and that would make this a INDISPENSABLE JAVASCRIPT REFERENCE GUIDE !!!
                                  • 14. Re: ANN: Indesign CS3 JS help to HTML using XSLT
                                    [Jongware] Most Valuable Participant
                                    Thanks, Rosta!

                                    I had a lot of fun hyperlinking the obvious items, but unfortunately, as Olav Kvern (responsible for the scripting model) explains somewhere else in this thread, some items are described as "free text" only. It's theoretically possible to weed the links out using XSLT, but the wording is quite different from case to case. And I'd rather not edit the original XML file by hand, as it is auto-generated by ID when needed, so new plugins can be added.

                                    Olav is aware of this and has been press-ganged to change it in future versions :-)

                                    For the moment I'm content with the HTML as it is -- I use it myself per default --, so don't expect any major changes.
                                    • 15. Re: ANN: Indesign CS3 JS help to HTML using XSLT
                                      Level 1
                                      thanks thats a very fair explanation

                                      hopefully, we all will get a new update (via Adobe Updater) of the scripting model soon (thumbs up Olav) with ALL the items FULLY HYPERLINKED by default, so somebody like you guys can generate new HTML with all the entries FULLY HYPERLINKED...

                                      indesigncs3jshelp.zip is BY NOW THE BEST MODEL DICTIONARY, or is it ?

                                      isnt there any proprietary of 3rd party viewer to load the scripting model and give us some more features ? like FIND with results, or other...