xsl-list
[Top] [All Lists]

Re: [xsl] how to workaround restriction of overloading functions

2012-07-17 11:22:49
xsl:attribute creates an attribute in the result tree, not in the stylesheet.

You want

<xsl:variable name="x" as="xs:string">
  <xsl:apply-templates.../>
</xsl:variable>
<xsl:result-document href="{x}"/>

Alternatively, encapsulate the call of apply-templates in a function, as I suggested in my response.

Michael Kay
Saxonica

On 17/07/2012 17:13, Robby Pelssers wrote:
I thought I was almost there but I run into my next issue.  F [Saxon-PE 
9.3.0.5] Cannot create an attribute node whose parent is a document node

Not sure how I can tackle this one.  Probably this was the reason why I chose 
the function approach in the first place

         <xsl:result-document method="xml">
             <xsl:attribute name="href">
                 <xsl:apply-templates select="." mode="getURI"/>
             </xsl:attribute>
             ....
         </xsl:result-document>


This would have worked
         <xsl:result-document method="xml" href="{znapz:getURI(.)}">
             ....
         </xsl:result-document>

Any thoughts?
Robby


-----Original Message-----
From: Robby Pelssers [mailto:Robby(_dot_)Pelssers(_at_)nxp(_dot_)com]
Sent: Tuesday, July 17, 2012 5:41 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] how to workaround restriction of overloading functions

;-)   simplicity rocks !!

Thx for the help again

Robby

-----Original Message-----
From: Andrew Welch [mailto:andrew(_dot_)j(_dot_)welch(_at_)gmail(_dot_)com]
Sent: Tuesday, July 17, 2012 5:35 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] how to workaround restriction of overloading functions

On 17 July 2012 16:32, Robby Pelssers <Robby(_dot_)Pelssers(_at_)nxp(_dot_)com> 
wrote:
Damn...

I was already thinking along those lines but I wasn't sure if such approach 
would work.


So let's assume I needed an uber-function that would return a sequence of 
URI's, would sth  like this work?

I want a list of all URI's stored in a variable uniqueURIs.  Since I can't use 
mode in a select statement like
<xsl:variable name="uniqueURIs" select="/maximo:*" mode="getURI"/>

I will probably need to call a function?
<xsl:variable name="uniqueURIs" select="znapz:getUniqueURIs(/maximo:*)"/>
or just apply-templates in the variable:

<xsl:variable name="uniqueURIs" as="xs:anyURI+">
   <xsl:apply-templates select="/maximo:*" mode="getURI"/>
</






--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--