You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lenya.apache.org by Jürgen Ragaller <ra...@apache.org> on 2008/03/08 15:08:53 UTC

[2.0.1] - question about xsl and the metadata transformer

Hi!

I am using metadata in an xsl Transformation.

No problem to insert metadata as a text value of an element:

<tag>
   <meta:value element="element-name"
	   ns="http://somedomain.ch/meta"
	   default="default-value"
	   uuid="{@uuid}"
	   lang="{$language}"/>
</tag>

What I couldn't figure out: is there a possibility (or trick...) to  
insert the metadata in an attribute? Having the metadata in an  
attribute would make the subsequent xsl where the metadata is  
interpreted much cleaner in my case.

xsl:attribute did not help (as <meta... is not a valid child element  
of xsl:attribute).

Help is appreciated!

TIA

Jürgen





---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: [2.0.1] - question about xsl and the metadata transformer

Posted by Jürgen Ragaller <ra...@apache.org>.
Good evening, Andreas!

Am Mar 8, 2008 um 20:31 schrieb Andreas Hartmann:

> Andreas Hartmann schrieb:
>> Jürgen Ragaller schrieb:
>>> Hi!
>>>
>>> I am using metadata in an xsl Transformation.
>>>
>>> No problem to insert metadata as a text value of an element:
>>>
>>> <tag>
>>>  <meta:value element="element-name"
>>>       ns="http://somedomain.ch/meta"
>>>       default="default-value"
>>>       uuid="{@uuid}"
>>>       lang="{$language}"/>
>>> </tag>
>>>
>>> What I couldn't figure out: is there a possibility (or trick...)  
>>> to insert the metadata in an attribute? Having the metadata in an  
>>> attribute would make the subsequent xsl where the metadata is  
>>> interpreted much cleaner in my case.
>> That's not possible yet.

... good to know.

>> But you can add a subsequent stylesheet to convert the element  
>> value into an attribute, e.g.:
>>  <xsl:template match="tag/text()">
>>    <xsl:attribute name="...">
>>      <xsl:value-of select="."/>
>>    </xsl:attribute>
>>  </xsl:template>
>
> I just noticed that this is not reliable if adjacent text nodes  
> occur instead of a combined one.
>
> This may be better:
>
>  <xsl:template match="tag">
>    <tag attribute="{.}"/>
>  </xsl:template>

I'll  try that (my current text value based approach feels... not so  
elegant ;-))

I filed an enhancement bug - the attribute syntax would be quite handy.


Thanks so much!

Jürgen






---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: [2.0.1] - question about xsl and the metadata transformer

Posted by Andreas Hartmann <an...@apache.org>.
Andreas Hartmann schrieb:
> Jürgen Ragaller schrieb:
>> Hi!
>>
>> I am using metadata in an xsl Transformation.
>>
>> No problem to insert metadata as a text value of an element:
>>
>> <tag>
>>   <meta:value element="element-name"
>>        ns="http://somedomain.ch/meta"
>>        default="default-value"
>>        uuid="{@uuid}"
>>        lang="{$language}"/>
>> </tag>
>>
>> What I couldn't figure out: is there a possibility (or trick...) to 
>> insert the metadata in an attribute? Having the metadata in an 
>> attribute would make the subsequent xsl where the metadata is 
>> interpreted much cleaner in my case.
> 
> That's not possible yet. But you can add a subsequent stylesheet to 
> convert the element value into an attribute, e.g.:
> 
>   <xsl:template match="tag/text()">
>     <xsl:attribute name="...">
>       <xsl:value-of select="."/>
>     </xsl:attribute>
>   </xsl:template>

I just noticed that this is not reliable if adjacent text nodes occur 
instead of a combined one.

This may be better:

   <xsl:template match="tag">
     <tag attribute="{.}"/>
   </xsl:template>

-- Andreas



> You could also file an enhancement bug to add the functionality to the 
> meta data transformer, e.g.
> 
>   <meta:attribute name="..."
>        element="element-name"
>        ns="http://somedomain.ch/meta"
>        default="default-value"
>        uuid="{@uuid}"
>        lang="{$language}"/>
> 
> -- Andreas
> 
> 


-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: [2.0.1] - question about xsl and the metadata transformer

Posted by Andreas Hartmann <an...@apache.org>.
Jürgen Ragaller schrieb:
> Hi!
> 
> I am using metadata in an xsl Transformation.
> 
> No problem to insert metadata as a text value of an element:
> 
> <tag>
>   <meta:value element="element-name"
>        ns="http://somedomain.ch/meta"
>        default="default-value"
>        uuid="{@uuid}"
>        lang="{$language}"/>
> </tag>
> 
> What I couldn't figure out: is there a possibility (or trick...) to 
> insert the metadata in an attribute? Having the metadata in an attribute 
> would make the subsequent xsl where the metadata is interpreted much 
> cleaner in my case.

That's not possible yet. But you can add a subsequent stylesheet to 
convert the element value into an attribute, e.g.:

   <xsl:template match="tag/text()">
     <xsl:attribute name="...">
       <xsl:value-of select="."/>
     </xsl:attribute>
   </xsl:template>


You could also file an enhancement bug to add the functionality to the 
meta data transformer, e.g.

   <meta:attribute name="..."
        element="element-name"
        ns="http://somedomain.ch/meta"
        default="default-value"
        uuid="{@uuid}"
        lang="{$language}"/>

-- Andreas


-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org