Hallo,

thank you all, I managed it. One clue was the 'cocoon:/' prefix:

<xsl:for-each select="*">
<xsl:variable name="cur"><xsl:value-of select="name()" /></xsl:variable> <xsl:variable name="curValue"><xsl:value-of select="current()" /></xsl:variable> <xsl:for-each select="document(concat('cocoon:/',$filename))/NodeA/NodeB/[EMAIL PROTECTED]'typevalue']"> <xsl:variable name="cur2"><xsl:value-of select="current()" /></xsl:variable> <xsl:choose> <xsl:when test="normalize-space($cur2)=normalize-space($cur)">
                         <td>
<input type="text" value="{$curValue}" name="{$cur}"/> </td>
                     </xsl:when>
                   <xsl:otherwise>
                      <td>
<xsl:value-of select="$curValue" />
                      </td>

                   </xsl:otherwise>
               </xsl:choose>

          </xsl:for-each >

   </xsl:for-each >

cheers

Dominic Tootell schrieb:
Jo,



Maybe you can work from the below example.




Example:


COB-INF/
       content/
               doc.xml
               additional.xml
       transforms/
               example_document_func.xsl

       sitemap.xmap



sitemap.xmap:
----------------


.....

  <map:pipeline>
                        
                        <map:match pattern="test-doc/">
                                <map:generate src="content/doc.xml"/>
                                <map:transform
src="transforms/example_document_func.xsl"/>
                                <map:serialize type="xml"/>
                        </map:match>
  </map:pipeline>

.....


doc.xml:
----------

<?xml version="1.0" encoding="UTF-8"?>
<root>
    <something>
        <blah/>
    </something>
    <insertdochere/>
</root>


Additional.xml:
----------------

<?xml version="1.0" encoding="UTF-8"?>
<frag>
    <text>balh</text>
</frag>


example_document_func.xsl:
---------------------------

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
<xsl:param name="filename" select="'../content/additional.xml'"/> <xsl:template match="/root">
        <root>
        <xsl:for-each select="./*">
            <xsl:choose>
                <xsl:when  test="name(.) = 'insertdochere' ">
                    <xsl:copy-of select="document($filename)" />
                </xsl:when>
                <xsl:otherwise>
                    <xsl:copy-of select="."/>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:for-each>
        </root>
</xsl:template> </xsl:stylesheet>


Call my block:


http://localhost:8888/<blockname-mapping>/test-doc/


results:
--------

<?xml version="1.0" encoding="UTF-8"?>
<root>
    <something>
        <blah/>
    </something>
    <frag>
        <text>balh</text>
    </frag>
</root>



/dom

-----Original Message-----
From: Lehtonen, Mika [mailto:[EMAIL PROTECTED] Sent: 11 June 2008 16:36
To: users@cocoon.apache.org
Subject: Re: problem with document() function

Maybe you could wrote a pipeline with a matcher to your $filename and
with source pointing to your absolute file?

- mika -

Heather Rankin kirjoitti:
Johannes, If you don't like absolute paths then you just need to figure out where your XSLT is relative to your XML doc. If your XSL is

in say, 'COB-INF/resource/internal/sql/transformation' you'll need '../resource/internal/sql/configuration/filename' (with file extension

of course).

-----Original Message-----
From: Johannes Hoechstaedter [mailto:[EMAIL PROTECTED]
Sent: 11 June 2008 15:58
To: users@cocoon.apache.org
Subject: Re: problem with document() function

Go away with absolute paths !!!!

Lehtonen, Mika schrieb:
Hi Johannes,

maybe you could try absolute path like:

   * UNIX ... file:///foo/bar/this.xsl
   * Windows ... file:///C:/foo/bar/this.xsl

Just to make sure that the file is fetched from the right location.

- mika -


Johannes Hoechstaedter kirjoitti:
The value of the variable $filename is correct, because I use this variable three times in the same stylesheet within xi:include statements, and it works. So the output of <xsl:value-of select="$filename" /> is correct. The output of <xsl:value-of select="document($filename)/*" /> is empty, and I get no error. Just

an empty value, where should be a value.

The file is located in "COB-INF/resource/internal/sql/configuration",
and I access it by "resource/internal/sql/configuration/filename". I

think it is correct or?.

Heather Rankin schrieb:
Hi Johannes,

Well firstly if you're using a variable to store your filename you shouldn't need quotes around it. Should just be <xsl:value-of select="document($filename)/NodeA/NodeB/NodeC" />

If that doesn't work it could be a problem with the path to your file or the path to your nodes. The XML needs to be well formed, but
if you're not getting an error then that shouldn't be a factor. I'd

make sure the file path is correct by trying to output everything in
the file <xsl:value-of select="document($filename)/*" /> or use doc-available to tell you.

According to your XML input your xpath looks ok (assuming first </NodeB> is <NodeB>).

Heather

-----Original Message-----
From: Johannes Hoechstaedter [mailto:[EMAIL PROTECTED]
Sent: 11 June 2008 14:58
To: users@cocoon.apache.org
Subject: Re: problem with document() function

Hi Heather,

yes I thought the same. Thats what I tried, only to test the
document()
function:

<xsl:value-of select="document('$filename')/NodeA/NodeB/NodeC" />

but I got no output. When I insert <xsl:value-of select="doc-available('$filename')" /> for example, nothing works anymore :)

The content of $filename is correct.

The xml structure of the file is:

<NodeA>
    </NodeB>               <NodeC>
            text
        </NodeC>         </NodeB>
</NodeA>

Could it be still a path issue?

Heather Rankin schrieb:
Hi Johannes,

You should be able to use the document() function to interrogate the contents of an external XML file. It is also a good idea to use doc-available() first to check for the existence of the file and build
the tree in memory.

Heather
-------------------------------------------------------------------
-
- To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your
system.
Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
-------------------------------------------------------------------
-
- To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--------------------------------------------------------------------
- To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain
personal views which are not the views of the BBC unless specifically
stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in
reliance on it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
                                        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal 
views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on 
it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
                                        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to