Tags:
create new tag
, view all tags

XmlXslPluginDev Discussion: Page for developer collaboration, enhancement requests, patches and improved versions on XmlXslPlugin contributed by the TWikiCommunity.
• Please let us know what you think of this extension.
• For support, check the existing questions, or ask a new support question in the Support web!
• Please report bugs below

Feedback on XmlXslPlugin

-- MartinCleaver - 26 Oct 2001

A small feedback, it would be more consistent to put parameter values in double quotes, i.e. %XMLSXLTRANSFORM{xml="xmlsource" xsl="xslsource"}%.

This can be parsed easily with TWiki::Func::extractNameValuePair().

-- PeterThoeny - 04 Jan 2002

XmlXslPlugin (offline TWiki) To: Martin@CleaverPLEASENOSPAM.org CC: peter.thoeny@attglobalPLEASENOSPAM.net

I see from this plugin that it use the transformNode to force the client side transformation.

       try {

            result = %SOURCE%.transformNode(style%SOURCE%.XMLDocument);

         }catch (exception) {

            //This could try other options, rather than just failing (fallback)
         }
       // insert the results into the page

 showResult%SOURCE%.innerHTML = result;

For single source url access this works great. As security reality catches up with open web access, controlling this limit will make plugins secure.

XmlUrlResolver() is an optional param to some version of transformNode example:

         trans1.Transform(xmlDoc,null,sw,new XmlUrlResolver());

         Response.Write(sw.ToString());

Objects can be built, to tell XmlUrlResolver of trusted sources (like Google, UDDI V4 registry.....)

These other source are from the XSLt processing a document("http:......?param") function . Results of one document call can be used to form the next document call.

Building param stings from TWiki content, would give you interactive web service with basic web-of-trust built in.

The other cool thing about transformNode, is the event that allows you to singlestep XSLt in the browser.

-- JohnCoe - 25 Mar 2004

One thing I'm looking for is an actual example of this working, since I can't get it to function. I use the format in Peter's comment below, but without the double quotes. No matter what I do it just spits back out verbatim my %XMLSXLTRANSFORM{xml=this.xml, xsl=that.xsl}%

-- ColmOGairbhith - 08 Feb 2005

I just installed it today and also had problems -- found it wasn't showing up in the ACTIVATEDPLUGINS list in TWiki.Preferences, and the examples weren't working for me. I edited XmlXslPlugin.pm to change all instances of XMLXSLPlugin to XmlXslPlugin and then it worked (running apache on solaris so figured case may be an issue), and the examples worked too. Note there's a typo in the examples above, should be XMLXSLTRANSFORM not XMLSXLTRANSFORM

%XMLXSLTRANSFORM{xml=/test.xml,xsl=/test.xsl}%

-- KarenAiken - 09 Feb 2005

Good stuff Karen, that sorted me out nicely. One remaining problem is how to implement a javascript which I inserted with the XSL. i.e. if I view the XML file directly in a browser i get a table which is sortable due to this javascript. When viewed in the wiki the javascript is not used so my table is static.

-- ColmOGairbhith - 16 Feb 2005

When I reference a CSS style sheet from the XSL file, this style sheet is not used in the generated topic. However, when viewing the XML directly (applying the XSL) then the style sheet is applied.

-- ThomasWeigert - 31 Mar 2005

I hope I am not stepping on MartinCleaver's toes here, but it said "Feel free to modify"....

I have updated this plugin as follows:

  • Fixed the inconsistencies between documentation and code
  • Fixed the name of the plugin in the *.pm file
  • Changed the parameters to follow TWiki conventions
  • Removed the restriction that there can only be one xml transformation per topic
  • Allow a CSS style sheet as parameter of the transformation which applies this style sheet

If there are problems, please yell at me, not Martin... smile

-- ThomasWeigert - 31 Mar 2005

I made some fixes to the topic text: Interwiki links, removedv links to itself, added license info, added appraisal link.

-- PeterThoeny - 01 Apr 2005

checked .zip into CVS

-- WillNorris - 19 Jul 2005

Hi, ive just discovered, installed and have unsucessfully been trying to get this plugin to work for me. im wondering if there are any working examples around... in the following cases i get:


%XMLXSLTRANSFORM{xml="http://www.w3schools.com/xsl/cdcatalog.xml" xsl="http://www.w3schools.com/xsl/cdcatalog.xsl" id="blah"}% (no output)
%XMLXSLTRANSFORM{xml="TestXmlCdCatalog" xsl="TestXslCdCatalog" id="foo"}% (i copied the xml trees in the above urls into these topics, but twiki renders them without the xml, and the plugin outputs those pages untranslated)

%XMLXSLTRANSFORM{xml="TestXmlCdCatal" xsl="TestXslCdCatal" id="boo"}% ( the xml you specirfed TestXmlCdCatal does not exist. the xsl you specified TestXslCdCatal does not exist)


any ideas? how to i setup debug mode? would file://some/full/network/path.xml url work as well as http:// ? do i need to make my twiki topics

?
what if you have an xsl that has xsl:import statement for another xsl?
can attached documents be handled?
what if you have an xml that has an <?xml-stylesheet type="text/xsl" href="someother.xsl"?> statement?

-- StevenDugaro - 30 Apr 2007

Hi,

I am using the Personal Twiki on Windows to try this out.

To test this plugin, I created

  1. ) CdXml is a topic page containing a sample xml file
  2. ) CdXsl is a topic page containing an xsl to display the xml
  3. ) Test topic containing the line %XMLXSLTRANSFORM{ xml="CdXml" xsl="CdXsl" id="a1" }%

When I enable the XmlXsl plugin and load the test topic, I get an Internal Server Error: [Sun May 20 14:51:51 2007] view.pl: Can't use string ("XMLXSLPLUGIN_EXAMPLE") as a HASH ref while "strict refs" in use at /twiki/twiki/lib/TWiki/Prefs.pm line 240.

Am I missing something in the plugin installation or my test method?

Thanks,

-- KweeTan - 20 May 2007

This plugin has not been updated to TWiki4 yet, which explains the errors you are seeing....

So sorry.

-- ThomasWeigert - 21 May 2007

I just checked, the plugin uses undocumented calls. Should be easy to fix in XmlXslPlugin.pm.

1. Remove this from the initPlugin function:

    # Get plugin preferences, the variable defined by:         
    $exampleCfgVar = &TWiki::Prefs::getPreferencesValue( "XMLXSLPLUGIN_EXAMPLE" ) || "default";

2. Replace TWiki::Store::normalizeWebTopicName() with TWiki::Func::normalizeWebTopicName()

-- PeterThoeny - 22 May 2007

those were already fixed in SVN, so i uplaoded a new version to the plugin topic. let us know how it goes?

-- WillNorris - 22 May 2007

I updated the new files and my TestTopic ( see earlier posting ) loads without the syntax error.

twiki/twiki/debug.txt shows that XmlXsl plugin is working : | 22 May 2007 - 09:44 | apply: xmlsource='CdXml' xslsource='CdXsl' id='a1'

However, nothing is displayed. Where would the resultant html go?

Thanks,

-- KweeTan - 22 May 2007

I was wondering if this plugin was updated for Twiki4? Like KweeTan, I tried using the plugin with three topic pages: one xml, one xsl and a test page with the XMLXSLTransform Directive.. Result: the display of my "test" topic page matched the display of the xml topic, there was no transform applied.

-- IraWeinstein - 29 Oct 2007

I think main problem is javascript in the plugin. Please, review attached XmlXslPlugin.pm file. It is not updated plugin. There is only basic functionality and you can set only Xml and Xsl sources. For testing, it is possible to replace original XmlXslPlugin.pm file.

Some examples: http://www.vstour.info/bin/view/Sandbox/XmlXsl

WillNorris, Please, tell me will you rework your plugin or I can do it?

-- RomanMishchenko - 10 Mar 2008

Topic attachments
I Attachment History Action Size Date Who Comment
Perl source code filepm XmlXslPlugin.pm r1 manage 10.1 K 2008-03-10 - 21:18 RomanMishchenko  
Edit | Attach | Watch | Print version | History: r22 < r21 < r20 < r19 < r18 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r22 - 2008-03-10 - RomanMishchenko
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.