Hi Clark here is a sample document
Very quickly the none obvious ones are: @thingy -> <xsl:attribute>
myNode {} <xsl:element>
(expression) denotes XPath
if {} else {} -> <xsl:when>
$variable = -> <xsl:variable>
transform errors {
template Root (/) {
// the root node is called epos and we reporduce it here
epos {
match(*);
}
}
// Copy the head field verbatim
template head (head) {
deep copy (.);
}
// The meaty work is here in taking the returned errors and placing
// them in the appropriate parts of the original documen
template body (screen) {
//Create a node called screen with action and id attributes copied
from the original
screen {
@action (@action) ;
@id (@id) ;
if(/epos/PAGE-ERROR) {
@error_id (/epos/PAGE-ERROR/@id);
@error_description (/epos/PAGE-ERROR/@description);
}
//Go through the returned values (except the REQUIREDFIELDS
field).
for(/epos/PAGE-ERROR/RETURNED-VALUES/[EMAIL PROTECTED] !=
'REQUIREDFIELDS'])
{
$thisid= (@id);
if (/epos/PAGE-ERROR/[EMAIL PROTECTED]) {
item {
@id (@id);
@value (@value);
@error_id
(/epos/PAGE-ERROR/[EMAIL PROTECTED]/@id);
@error_description
(/epos/PAGE-ERROR/[EMAIL PROTECTED]/@description);
}
} else {
item {
@id (@id);
@value (@value);
}
}
}
//Add the original items if they are not included elsewhere as
errors or resolutions
for(item) {
$thisid= (@id);
if(/epos/RETURNED-VALUES/[EMAIL PROTECTED]) {
// do nothing
} else {
item {
@id (@id);
@value (@value);
$thisid= (@id);
if (/epos/PAGE-ERROR/[EMAIL PROTECTED]) {
@error_id
(/epos/PAGE-ERROR/[EMAIL PROTECTED]/@id);
@error_description
(/epos/PAGE-ERROR/[EMAIL PROTECTED]/@description);
}
}
}
}
}
}
// I forget what this is about :-)
template errors(PAGE-ERROR) {
}
}
The XSL is (you may want to beautify this :-)
NB: This uses ORACLE extensions but I have a switch at the mo for apache
instead
<?xml version='1.0'?><xsl:stylesheet version='1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
xmlns:ora='http://www.oracle.com/XSL/Transform/java/'><xsl:template
name="Root" match="/" ><xsl:element name="epos"><xsl:apply-templates
select="*"/></xsl:element></xsl:template><xsl:template name="head"
match="head" ><xsl:copy-of select="."/></xsl:template><xsl:template
name="body" match="screen" ><xsl:element name="screen"><xsl:attribute
name="action"><xsl:value-of select="@action"/></xsl:attribute><xsl:attribute
name="id"><xsl:value-of select="@id"/></xsl:attribute><xsl:choose><xsl:when
test="/epos/PAGE-ERROR"><xsl:attribute name="error_id"><xsl:value-of
select="/epos/PAGE-ERROR/@id"/></xsl:attribute><xsl:attribute
name="error_description"><xsl:value-of
select="/epos/PAGE-ERROR/@description"/></xsl:attribute></xsl:when></xsl:cho
ose><xsl:for-each select="/epos/PAGE-ERROR/RETURNED-VALUES/[EMAIL PROTECTED] !=
'REQUIREDFIELDS']"><xsl:variable name="thisid"><xsl:value-of
select="@id"/></xsl:variable><xsl:choose><xsl:when
test="/epos/PAGE-ERROR/[EMAIL PROTECTED]"><xsl:element
name="item"><xsl:attribute name="id"><xsl:value-of
select="@id"/></xsl:attribute><xsl:attribute name="value"><xsl:value-of
select="@value"/></xsl:attribute><xsl:attribute
name="error_id"><xsl:value-of
select="/epos/PAGE-ERROR/[EMAIL PROTECTED]/@id"/></xsl:attribute><xsl:a
ttribute name="error_description"><xsl:value-of
select="/epos/PAGE-ERROR/[EMAIL PROTECTED]/@description"/></xsl:attribu
te></xsl:element></xsl:when><xsl:otherwise><xsl:element
name="item"><xsl:attribute name="id"><xsl:value-of
select="@id"/></xsl:attribute><xsl:attribute name="value"><xsl:value-of
select="@value"/></xsl:attribute></xsl:element></xsl:otherwise></xsl:choose>
</xsl:for-each><xsl:for-each select="item"><xsl:variable
name="thisid"><xsl:value-of
select="@id"/></xsl:variable><xsl:choose><xsl:when
test="/epos/RETURNED-VALUES/[EMAIL PROTECTED]"></xsl:when><xsl:otherwise><xs
l:element name="item"><xsl:attribute name="id"><xsl:value-of
select="@id"/></xsl:attribute><xsl:attribute name="value"><xsl:value-of
select="@value"/></xsl:attribute><xsl:variable name="thisid"><xsl:value-of
select="@id"/></xsl:variable><xsl:choose><xsl:when
test="/epos/PAGE-ERROR/[EMAIL PROTECTED]"><xsl:attribute
name="error_id"><xsl:value-of
select="/epos/PAGE-ERROR/[EMAIL PROTECTED]/@id"/></xsl:attribute><xsl:a
ttribute name="error_description"><xsl:value-of
select="/epos/PAGE-ERROR/[EMAIL PROTECTED]/@description"/></xsl:attribu
te></xsl:when></xsl:choose></xsl:element></xsl:otherwise></xsl:choose></xsl:
for-each></xsl:element></xsl:template><xsl:template name="errors"
match="PAGE-ERROR" ></xsl:template></xsl:stylesheet>
> -----Original Message-----
> From: Clark OBrien [SMTP:[EMAIL PROTECTED]
> Sent: 27 February 2002 16:32
> To: '[EMAIL PROTECTED]'
> Subject: RE: XML application server
>
>
> Neil,
> I would be interested in seeing a snippet of your scripting language in
> action.
> I am working on a project to implement the IMS testing standads:
> http://www.imsproject.org/question/index.html
>
> I found all XML processing libraries DOM, SAX, and XSLT, become
> heavyweight
> with this end to end XML stuff. I switched from Java to Python and noticed
>
> a big improvement in my productivity.
>
>
>
>
>
>
>
>
>
> -----Original Message-----
> From: Ellis, Neil (FNB) [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, February 27, 2002 7:43 AM
> To: '[EMAIL PROTECTED]'
> Subject: RE: XML application server
>
>
> Hmmm that was the direction I was looking for...
>
> I like Zope's ideas, but I'm not entirely convinced about some
> implementation choices.
>
> So I saw DBXML as a good object repository where the objects data can be
> serialized as XML and I was looking to avoid using Java as the programming
> language as it can be quite heavyweight at times. So XSLT seemed nearly
> pefect. The main trouble with XSLT you only realise if you try to program
> with it. It totally goes against the grain for a programmer, being very
> verbose and unsuitable for general purpose programming. However it's way
> of
> working with XML is elegant.
>
> So logically I just wrote a simple scripting language which produces XSL
> with some use of extensions. It is a prototype at the moment as it only
> handles a small subset of XSLT however the power of XSLT starts to show
> through when you remove the bulky syntax.
>
> I'm looking at taking it much further with Xalan specific features and
> glancing at the Cocoon/Xindice partnership possibilities it could be taken
> further into this area, I'll see.
>
> Thanks Clark for your input .... ideas begin to clarify a little ... so I
> need to look at Cocoon now :-)
>
> Many regards
> Neil
>
> > -----Original Message-----
> > From: Clark OBrien [SMTP:[EMAIL PROTECTED]
> > Sent: 27 February 2002 15:26
> > To: '[EMAIL PROTECTED]'
> > Subject: RE: XML application server
> >
> >
> >
> > Stefano Mazzocchi suggests XIndice may soon be integrated with cocoon-
> > apologies
> > if everyone already knows this.
> >
> >
> > From the Zope-dev list:
> > Setfano:
> > We haven't packaged XIndice with Cocoon yet, because current version of
> > XIndice is CORBA based and adds another 2/3 Mbs that might not be
> > worth-it for now.
> >
> > At the same time: we are workign closely with the XIndice community to
> > make sure that future versions of XIndice are Soap/XML-RPC based
> > (instead of CORBA, which also has several encoding interoperability
> > problems with most ORBs), thus much lighter and we'll probably ship that
> > integrated.
> >
> >
> >
> >
> >
> >
> > -----Original Message-----
> > From: Ellis, Neil (FNB) [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, February 27, 2002 1:43 AM
> > To: '[EMAIL PROTECTED]'
> > Subject: RE: XML application server
> >
> >
> > Thanks Kimbro I will take a look.
> >
> >
> > Many regards
> > Neil
> >
> > > -----Original Message-----
> > > From: Kimbro Staken [SMTP:[EMAIL PROTECTED]
> > > Sent: 26 February 2002 16:20
> > > To: [EMAIL PROTECTED]
> > > Subject: Re: XML application server
> > >
> > > You could look at the combination of Tomcat/Cocoon/Xindice as such a
> > > beast.
> > > Cocoon has some built in connectivity for Xindice.
> > >
> > > On Tuesday, February 26, 2002, at 02:51 AM, Ellis, Neil (FNB) wrote:
> > >
> > > > Dear All
> > > >
> > > > I've been considering the idea of building an
> > > XML/XSLT/XUpdate/XPath/Java
> > > > based application server using Xindice as the base.
> > > >
> > > > This is because I have been working on a scripting language which
> > > > translates itself to the less human readable form of XSLT and would
> > like
> > >
> > > > to
> > > > take it a bit further and incorporate XUpdate and XPath database
> > > searches
> > > > as
> > > > native to the language.
> > > >
> > > > To do this I then need to build an application server to execute the
>
> > > > objects
> > > > built from the language. I don't want to do anything fancy really, I
> > was
> > > > intending to use Xindice as the base and make maximum use of the
> > > fantastic
> > > > functionality with it.
> > > >
> > > > Now the question I'd like to ask is ... has anyone started down
> these
> > > > lines
> > > > yet ..
> > > >
> > > > Many regards
> > > > Neil Ellis
> > > >
> > > >
> > > Kimbro Staken - http://www.kstaken.org - http://www.xmldatabases.org
> > > Apache Xindice native XML database http://xml.apache.org/xindice
> > > XML:DB Initiative http://www.xmldb.org
> > > Senior Technologist (Your company name here)