judgement support - accessing global xpaths within a minixslt

1 view
Skip to first unread message

Ashok Hariharan

unread,
Sep 3, 2009, 5:56:43 AM9/3/09
to akomantoso-dev
Hi luca,

I have added judgement document type support to the translator .. and
everything is working fine.

I just have a small problem. From within the minixslt template i am
unable to access XPaths in the global metalex document ...

for e.g. in the judgement ref.xsl, i cannot access the //root/@id
xpath ... it always returns blank (not just for that one... but for
anything else outside @name='ref' ...

<xsl:template match="*[@name='ref']">
......
<xsl:variable name="rootId" select="//root/@id" />
......

</xsl:template>


Am i missing something ? How do i access global xpaths from the minixslt ?

Ashok

Luca Cervone

unread,
Sep 3, 2009, 6:12:04 AM9/3/09
to akomant...@googlegroups.com
Hi Ashok, 

I have added judgement document type support to the translator .. and
everything is working fine.


Great! 
But I cannot understand the problem that you have with the minixslt ... can you explain it well? 

Thank you. 
Ciao
Luca




Luca Cervone
Web and XML solutions designer

e-mail:     cervo...@gmail.com

mobile phone:    0039 348 26 27 545
home   phone:  0039 051 199 82 854

skype:   cervoneluca



Ashok Hariharan

unread,
Sep 3, 2009, 6:44:43 AM9/3/09
to akomant...@googlegroups.com
On Thu, Sep 3, 2009 at 1:12 PM, Luca Cervone <cervo...@gmail.com> wrote:
> Great!
> But I cannot understand the problem that you have with the minixslt ... can
> you explain it well?

Here you go ...

In the ref.xsl for the judgement -- i am processing references
selectively ... in the example below i am filtering by @class and
generating a <party> element ... all that works fine.

<xsl:template match="*[@name='ref']">
.....

<xsl:when test="@class='BungeniPartyName'">
<party>
<!-- we use the tokenize() function to extract the refersTo attrib
from the reference href the id is a generated one -->
<xsl:variable name="strHref"><xsl:value-of select="@href"
/></xsl:variable>
<xsl:variable name="tokenizedHref" select="tokenize($strHref,';')"/>
<xsl:variable name="metadataRefRole"
select="//meta[@id='$tokenizedHref[1]']/@inrole" />

<xsl:attribute name="id">
<xsl:value-of select="generate-id()" />
</xsl:attribute>
<xsl:attribute name="refersTo">
<xsl:text>#</xsl:text><xsl:value-of select="$tokenizedHref[1]" />
</xsl:attribute>
<xsl:attribute name="as">
<xsl:text>#</xsl:text><xsl:value-of select="$metadataRefRole" />
</xsl:attribute>
<xsl:value-of select="."/>
</party>
</xsl:when>


the problematic part is this line :

<xsl:variable name="metadataRefRole"
select="//meta[@id='$tokenizedHref[1]']/@inrole" />

I try to get the inrole attribute of the meta[@id=something]
element (which is not in the matched node ... but is part of the meta
block of the metalex xml document... however this always returns an
empty...

After a bit of testing i realized this happens for every node outside
the matched node ..... why is this happening ?

is the minixslt applied only on the matched node ?

Ashok Hariharan

unread,
Sep 3, 2009, 8:49:03 AM9/3/09
to akomant...@googlegroups.com
See attached intermediate metalex output ... and the ref.xsl minixslt ....
Ashok
test_judgement_header.mlx
ref.xsl

Ashok Hariharan

unread,
Sep 4, 2009, 8:17:40 AM9/4/09
to akomant...@googlegroups.com
Hi Luca,

Were you able to take a look at this issue ?

Ahsok

Ashok Hariharan

unread,
Sep 7, 2009, 6:26:23 AM9/7/09
to akomant...@googlegroups.com
Hi Luca:

I realized what the problem was ... there is no namespace declaration
for metalex in any of the minixslt .... because of this any global
xpath reference in the minixslt will not work ....

If i add the metalex namespace to the minixslt 's xsl:stylesheet
definition it works :

<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ml="http://www.metalex.org/1.0">

Ashok

Ashok Hariharan

unread,
Sep 7, 2009, 7:12:10 AM9/7/09
to akomant...@googlegroups.com
I also had to add the following attribute :

xsl:exclude-result-prefixes="#all"

to the element using the global xpath variable ... otherwise it emits
the metalex namespace attribute in the output AN document.

Ashok

Reply all
Reply to author
Forward
0 new messages