AnsweredAssumed Answered

unable to include xml file in xsl

Question asked by roxanne on Oct 3, 2008
hi,

ive been trying to include a simple xml file in xsl to enable key-value properties.

is there any other way i can include an external xml file in my xsl?

i've tried the following:

this is my xsl:


    <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  xmlns:sample="http://sample.org" xmlns:my_ns="http://www.alfresco.org/alfresco/my_ns" exclude-result-prefixes="xsl sample fn" xmlns:fn="http://www.w3.org/2005/02/xpath-functions"  version="1.0">      
       <xsl:output method="xml" indent="yes"/>



    <xsl:template match="/Home/properties">

            <xsl:apply-templates select="document('properties.xml')/Home/properties/property[name='country']/value"/>  
      

    </xsl:template>
    </xsl:stylesheet>





this is my simple xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="properties2.xsl"?>
    <Home>
    <properties>
      <property>
       <name>language</name>
       <value>en</value>
    </property>

    <property>
       <name>country</name>
       <value>US</value>
    </property>
    </properties>
    </Home>





i'm trying to retrieve a value for a key…
outside alfresco, i get this answer: US, which is right.

but i don't know how to implement it in alfresco.

do i have to correct the relative path/should there be another namespace? /is there any other alternative?

in any case, please do send me a complete solution!

thanku very very much!

rox

Outcomes