[thelist] XSLT question

Eric Cestari eric at ohmforce.com
Tue Aug 14 07:53:59 CDT 2001

Well I found out by myself.
Sorry for the unnecessary noise.
The solution was, using the compact form :
<xsl:template match="texte">
  No Page : <xsl:value-of select="../@no"/>

Yet, I don't know why the expanded form did not work.

<tip type="DomXml and PHP" author="Eric Cestari">
The actual DomXml support for PHP is quite weak. No deleting, no 
ordering while adding nodes.
  For content management, it is not very useful.

Yet, if you went to use PHP for XML application, use two attributes for 
each of your elements, 'position' and 'delete'.
'position' refers to the ordering within the children of an element, and 
elements with attributes delete='1' are to be deleted.

Then use a XSL to reorder your elements and delete element.



Eric Cestari wrote:

> I want the value of an attribute from the parent of an element.
> i.e. example XML file :
> <page no="1" titre="Un titre de page">
>    <texte id_pos="39">test de breve</texte>
>    <texte id_pos="40">retest</texte>
> </page>
> While rendering a 'texte' element I'd like to have access to the value 
> of the 'no' attribute of the parent page ('1' in this case).
> I've tried (for the sake of the example):
> <xsl:template match="texte">
>     No Page : <xsl:value-of select="string(parent::attribute/@no)"/>
> </xsl:template>
> But it doesn't work. Am I missing something ?

More information about the thelist mailing list