You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Sam Fuqua <sa...@gmail.com> on 2009/03/19 22:07:09 UTC

XML-XSLT Namespaces

I am trying to create a FOP through an XSLT and am having some trouble with
namespaces.
The XML is being generated clientside and being posted to the server.  The
server has an XSL on the filesystem which it uses.  The XML generated has
namespaces which seem to conflict with the FO namespaces.  I can get it to
work with the command line when the namespaces are absent, but thwen they
are present it just throws out an empty PDF.  Has anyone experienced this or
know why this is happening?

-- 
Sam Fuqua
ΣΝ ΘΗ 454

Re: XML-XSLT Namespaces

Posted by Sam Fuqua <sa...@gmail.com>.
Thanks, that worked perfectly.

On Thu, Mar 19, 2009 at 5:25 PM, Andreas Delmelle <
andreas.delmelle@telenet.be> wrote:

> On 19 Mar 2009, at 22:07, Sam Fuqua wrote:
>
> Hi
>
>  I am trying to create a FOP through an XSLT and am having some trouble
>> with namespaces.
>> The XML is being generated clientside and being posted to the server.  The
>> server has an XSL on the filesystem which it uses.  The XML generated has
>> namespaces which seem to conflict with the FO namespaces.  I can get it to
>> work with the command line when the namespaces are absent, but thwen they
>> are present it just throws out an empty PDF.  Has anyone experienced this or
>> know why this is happening?
>>
>
> Is the document namespace also declared in the stylesheet?
>
> If you have the following root:
>
> <svg xmlns="http://www.w3.org/2000/svg">
> ...
>
> Then, to process that node in XSLT, you need either:
>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                xmlns="http://www.w3.org/2000/svg">
> ...
>
> <xsl:template match="svg">
> ...
>
> or
>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                xmlns:svg="http://www.w3.org/2000/svg">
> ...
> <xsl:template match="svg:svg">
> ...
>
> The first option is actually not very convenient, since it would also mean
> that the default namespace for the result tree will be the SVG namespace.
> The better practice is to bind a prefix and use qualified names in the
> matching patterns.
>
> HTH!
>
> Andreas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>


-- 
Sam Fuqua
ΣΝ ΘΗ 454

Re: XML-XSLT Namespaces

Posted by Andreas Delmelle <an...@telenet.be>.
On 19 Mar 2009, at 22:07, Sam Fuqua wrote:

Hi

> I am trying to create a FOP through an XSLT and am having some  
> trouble with namespaces.
> The XML is being generated clientside and being posted to the  
> server.  The server has an XSL on the filesystem which it uses.  The  
> XML generated has namespaces which seem to conflict with the FO  
> namespaces.  I can get it to work with the command line when the  
> namespaces are absent, but thwen they are present it just throws out  
> an empty PDF.  Has anyone experienced this or know why this is  
> happening?

Is the document namespace also declared in the stylesheet?

If you have the following root:

<svg xmlns="http://www.w3.org/2000/svg">
...

Then, to process that node in XSLT, you need either:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 xmlns="http://www.w3.org/2000/svg">
...

<xsl:template match="svg">
...

or

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 xmlns:svg="http://www.w3.org/2000/svg">
...
<xsl:template match="svg:svg">
...

The first option is actually not very convenient, since it would also  
mean that the default namespace for the result tree will be the SVG  
namespace. The better practice is to bind a prefix and use qualified  
names in the matching patterns.

HTH!

Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org