Reputation: 7608
I have the following issue with XSL namespaces. I produce a PDF using FOP with one XSL file and one XML file.
Here is my XML file:
<?xml version= "1.0" encoding= "ISO-8859-2"?>
<ReportContent>BLABLA<yt:picture src="pic.png"/></ReportContent>
Here is my XSL file:
<?xml version="1.0" encoding="ISO-8859-2"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:yt="http://www.yt.com/text/2"
>
<xsl:template match="/">
<fo:root >
[...]
<fo:flow >
<fo:block> <xsl:apply-templates select='ReportContent'> </xsl:apply-templates></fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>
I need to include the namespace yt:. When I do it in the xml like this:
<?xml version= "1.0" encoding= "ISO-8859-2"?>
<ReportContent xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:yt="http://www.yt.com/text/2">
BLABLA<yt:picture src="pic.png"/>
</ReportContent>
It works perfectly.
But in real life I cannot add namespace to my xml (the way the xml is created doesn't allow it).
So I tried to write it only on the xsl but it doesn't work at all .(I tried to add it to every tag in the xsl and it doesn't work).
I don't understand how this whole namespace thing works...
Can you help me find where to put the namespace in the xsl so I don't get any error.
Hope my question is clear
Thanks in advance.
Upvotes: 0
Views: 3140
Reputation: 27996
@Ricky, yes, the XML has to be changed. Sorry. It should look something like this:
<?xml version= "1.0" encoding= "ISO-8859-2"?>
<ReportContent xmlns:yt="http://www.yt.com/text/2">BLABLA<yt:picture src="pic.png"/>
</ReportContent>
Upvotes: 2