General XMetaL Discussion
paorear May 16, 2014 at 1:35 am
Trap links in Page Preview?May 16, 2014 at 1:35 amParticipants 5Replies 6Last Activity 8 years, 4 months ago
When viewing a topic in Page Preview, is it possible programmatically to capture a navigation request prior to navigating, so that redirection or other processing could be accomplished and possibly handing back a different URI to the Page Preview browser?
Paul O'Rearpaorear May 16, 2014 at 2:01 am
Reply to: Trap links in Page Preview?May 16, 2014 at 2:01 am
To clarify, I don't mean On_Before_Document_Preview, I'm thinking in the context of an already previewed page – e.g. capturing the Navigate() event of the underlying browser control.
P.Derek Read May 16, 2014 at 9:14 pm
Reply to: Trap links in Page Preview?May 16, 2014 at 9:14 pm
Perhaps if you could describe what the user would be doing to initiate the action and then exactly what the action would trigger I might be able to tell you if that would be possible.paorear May 16, 2014 at 9:47 pm
Reply to: Trap links in Page Preview?May 16, 2014 at 9:47 pm
The user would be clicking on a link to another topic in our CMS that is not transformed into HTML on the local machine. The idea would be to intercept the link request, pull the topic from the CMS and transform on the fly and then pass back the URI to the newly transformed and linked topic to the Page Preview.
P.Derek Read May 16, 2014 at 10:32 pm
Reply to: Trap links in Page Preview?May 16, 2014 at 10:32 pm
Hmmm. Still not exactly clear to me.
Does this mean the user would be clicking on an element inside an XML document in Tags On or Normal view to trigger this action?
If so, you'd probably just use the On_Click event for that. It should be easy enough to include code in On_Click that calls an external application (whatever is doing your transform) and when that app returns the rest of the code in On_Click could open the resulting file in an external copy of IE (or whatever external application you want to display it in).
If you need to have the resulting file render in Page Preview you could switch to that view when On_Click fires (ActiveDocument.ViewType = 3), but I'm not sure how easy it will be to change what is displayed in there. By default XMetaL creates a temp file which is then transformed using auto-generated XSLT (based on your CSS and the DTD itself) and the resulting file is rendered in the copy of IE embedded in Page Preview. I think you would probably need to rewrite the macro file multipleOutput.mcr in the Startup folder to do that. A lot of it may need to be rewritten.
If your users work with DITA files then this becomes more complex because switching to Page Preview in this case includes running the DITA Open Toolkit to perform the transformation.
Are you the creator of the CMS integration that connects XMetaL Author Enterprise to the CMS? If not, you may wish to request that they investigate this functionality.paorear May 20, 2014 at 10:15 pm
Reply to: Trap links in Page Preview?May 20, 2014 at 10:15 pm
No – what I'm describing is that a user is looking at a page in Page Preview. This is XML rendered to HTML. That page in preview has a link to another XML “topic” that is in our CMS, that will ultimately be transformed to HTML as well.
So the user previews the page – clicks on a link to another page that is not local, or transformed yet. I'd like to catch that request, pull down the xml topic from our CMS and transform it on the fly.
This is using our own custom CMS, and we own all the other logic for transforming XML to HTML otherwise for the standard page preview scenario. We currently do something what you describe when we preview now – where we do the transforming process and then pass our own temp .html file back to the preview view.
We are working with our own schema as well.
I've also been interested in getting more information about the CMS integration toolkit, but have not been successful in finding the route to get that information yet.
PaulDerek Read May 26, 2014 at 9:05 pm
Reply to: Trap links in Page Preview?May 26, 2014 at 9:05 pm
At that point XMetaL has no events you could hook into. For this to work I think your initial transformation would need to put code into the (first) HTML page, hooking an event inside of IE that would do this secondary stuff.
However, perhaps, given that the first page contains a link to another page, you could build some kind of “generate output by following links” feature into your output generator. It would look for your links, find those pages and generate output for them when the initial page is generated just in case the user wants to visit them as well.
- You must be logged in to reply to this topic.