|
From: Sean M. <sea...@pr...> - 2002-03-04 10:02:10
|
Roger, Parameter passing is top of my list. It is the very next thing I'm going to work on. regards, Sean At 14:33 02/03/2002 -0500, Roger L. Costello wrote: >I am trying to use the parameter element in xcomponents. I have created >an xcomponent which changes the name of an element, where the name of >the element to be replaced and its replacement value are specified as a >parameter [see the xcomponent below]. The problem is that the >parameters don't seem to be getting to my xcomponent's code (a >stylesheet). Am I doing something wrong, or is it simply that >parameters have not been implemented yet? > >My second question is more general, on how parameters get delivered to >an xcomponent's code. I assume that when the code is xslt the >parameters get delivered just as stylesheet parameters. Right? What if >the code is Java? Do the parameters get delivered as parameters to the >main routine, i.e., > >public static void main(String[] args) > >The parameters will be in the args array? > >As I dig deeper I am getting more and more excited about this >technology. This is the right approach I feel. I wish that I had the >time to help implement the core pieces. Timeliness is crucial, I >think. /Roger > >changeElementName.xco > ><xcomponent> ><version>0.1</version> ><title>Change Element Name - XSLT</title> ><keywords> > <keyword>XSLT</keyword> > <keyword>Change Element Name</keyword> ></keywords> ><authorInfo> > Roger L. Costello ></authorInfo> > ><doc> ><h1>Change Element Name</h1> ><p>Change the name of an element</p> ></doc> > ><parameters> > <parameter >name="nameOfElementToChange">WorldFactbookReferenceDeskRequest</parameter> > <parameter >name="newNameOfElement">WorldFactbookReferenceDeskRequestResults</parameter> ></parameters> > ><unitTests> > <test name ="First Test"> > <parameters> > <parameter >name="nameOfElementToChange">foo</parameter> > <parameter name="newNameOfElement">bar</parameter> > </parameters> > <pre/> > <input href="#unitTestFile1"/> > <output href="#unitTestFile2"/> > <post/> > </test> ></unitTests> > ><pre/> ><code type="XSLT" encoding="PLAIN" extractFilename="" >CLASSPATH=""><![CDATA[ ><!-- Change the name of an element --> ><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > version="1.0"> > > <xsl:output method="xml"/> > <xsl:param name="nameOfElementToChange"/> > <xsl:param name="newNameOfElement"/> > > <xsl:template match="*"> > <xsl:if test="name(.) != $nameOfElementToChange"> > <xsl:element name="{name(.)}"> > <xsl:for-each select="@*"> > <xsl:attribute name="{name(.)}"> > <xsl:value-of select="."/> > </xsl:attribute> > </xsl:for-each> > <xsl:apply-templates/> > </xsl:element> > </xsl:if> > <xsl:if test="name(.) = $nameOfElementToChange"> > <xsl:element name="{$newNameOfElement}"> > <xsl:for-each select="@*"> > <xsl:attribute name="{name(.)}"> > <xsl:value-of select="."/> > </xsl:attribute> > </xsl:for-each> > <xsl:apply-templates/> > </xsl:element> > </xsl:if> > </xsl:template> > ></xsl:stylesheet> >]]> ></code> ><post/> > ><resources> ><resource id = "unitTestFile1"> ><![CDATA[ ><?xml version="1.0"?> ><test isIt="true"><foo>Hello World</foo></test> >]]> ></resource> > ><resource id = "unitTestFile2"> ><![CDATA[ ><?xml version="1.0"?> ><test isIt="true"><bar>Hello World</bar></test> >]]> ></resource> ></resources> > ></xcomponent> > > >_______________________________________________ >Xpipe-users mailing list >Xpi...@li... >https://lists.sourceforge.net/lists/listinfo/xpipe-users http://www.propylon.com |