Subject: Re: Antwort: Re: two xml source documents
From: Joerg Heinicke <joerg.heinicke@xxxxxx>
Date: Mon, 05 Aug 2002 18:11:23 +0200
|
Hello Markus,
after your last mail I had a look again at this code. And the solution is
easier than you might think:
In the second file, you have declared a default namespace
> <beratung xmlns="http://www.mlp.com">
> <stattext>Sie wurden beraten von</stattext>
> </beratung>
This means the elements <beratung> and <stattext> have the namespace
"http://www.mlp.com" even when they have no namespace-prefix. To match them
in XSLT you have to refer to the namespace (not the prefix). In XSLT you
can't match on elements in default namespace without declaring this
namespace on a namespace prefix explicitely. You have done this already with
your namespace prefix 'my'.
So a <xsl:apply-templates select="$doc2/my:beratung/my:stattext"/> should
solve your problem.
Regards,
Joerg
Markus.Lehr@xxxxxxxxxx wrote:
Hello Joerg,
I tried your solution but there must be something I`m doing wrong. It simply
does not acces the second xml-file...
I got both xml-files in the same directory, so I think I don´t need to give it a
path, do I?
Here´s the (more or less) relevant part of the stylesheet
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xmlns:my="
http://www.mlp-ag.com"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:variable name="doc2" select="document ('Testmich2.xml')"/>
<xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
.....
<fo:flow flow-name="xsl-region-body">
<fo:table>
<fo:table-column column-width="40mm"/>
<fo:table-column column-width="70mm"/>
<fo:table-column column-width="70mm"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell ><fo:block ></fo:block></fo:table-cell>
<fo:table-cell ><fo:block>Beratung:</fo:block></fo:table-cell>
<fo:table-cell> <fo:block></fo:block><fo:block><
xsl:apply-templates select="doc2/beratung/stattext"/></fo:block></fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
and here´s the xml-file
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="C:\Test\iftestfooter.xsl"?>
<beratung xmlns="http://www.mlp.com" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance">
<stattext>Sie wurden beraten von</stattext>
</beratung>
Could you please take a look at it?
--
System Development
VIRBUS AG
Fon +49(0)341-979-7419
Fax +49(0)341-979-7409
joerg.heinicke@xxxxxxxxx
www.virbus.de
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|