AnsweredAssumed Answered

xml element values using parseXMLDocuments

Question asked by boneill on Jul 23, 2008
Latest reply on Oct 22, 2008 by giorgio.cardellini
Hi all,

I am trying to read xml element values from existing webform created xml documents during the rendering process (xslt) of a different document.  In this case an xml document has a model:model_details/model:price element.

I have used the parseXMLDocuments method to get all documents that are created from a specific webform in the specified virtual path.  That works fine and I know I am getting the correct documents because the File Name below is populated correctly.


<xsl:for-each select="alf:parseXMLDocuments('model','/models/xml')">
      
     <xsl:variable name="vehicle"><xsl:value-of select="."/></xsl:variable>
    [b]File Name = <xsl:value-of select="fn:replaceAll(string(@alf:file_name), '.xml', '')"/>[/b]    Model Price <xsl:value-of select="$vehicle/model:model_details/model:price"/>
</xsl:for-each>

However the element value, price, I am trying to get comes back as empty.  I thought the $vehicle variable would be the root node of the xml document and whence the xpath $vehicle/model:model_details/model:price would get me the value.  Can anyone spread any light on what the problem may be.  Am pulling my hair out.


Model Price <xsl:value-of select="$vehicle/model:model_details/model:price"/>

Should reference price in this xml:

<model:model xmlns:alf="http://www.alfresco.org" xmlns:chiba="http://chiba.sourceforge.net/xforms" xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:model="http://www.seedim.com.au/alfresco/model" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <model:model_details>
        <model:model_name>tiida</model:model_name>
        <model:heading>Model Heading</model:heading>
        <model:image>/resources/advertising banners/bgimage.jpg</model:image>
        <model:price>19990</model:price>
        <model:thumbnail>/resources/models/flyouts/warranty.png</model:thumbnail>
        <model:rollover_thumbnail xsi:nil="false">/resources/models/flyouts/warranty.png</model:rollover_thumbnail>
    </model:model_details>
</model:model>

Outcomes