[prev in list] [next in list] [prev in thread] [next in thread]
List: fop-user
Subject: Re: XML-XSLT Namespaces
From: Sam Fuqua <samfuqua () gmail ! com>
Date: 2009-03-19 21:39:16
Message-ID: e0af82400903191439i6c2f9d96w3f087acdfe4d6b72 () mail ! gmail ! com
[Download RAW message or body]
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
[Attachment #3 (text/html)]
Thanks, that worked perfectly.<br><br><div class="gmail_quote">On Thu, Mar 19, 2009 \
at 5:25 PM, Andreas Delmelle <span dir="ltr"><<a \
href="mailto:andreas.delmelle@telenet.be">andreas.delmelle@telenet.be</a>></span> \
wrote:<br> <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, \
204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">On 19 Mar 2009, at 22:07, \
Sam Fuqua wrote:<br> <br>
Hi<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); \
margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> I am trying to create a FOP through \
an XSLT and am having some trouble with namespaces.<br> 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?<br>
</blockquote>
<br></div>
Is the document namespace also declared in the stylesheet?<br>
<br>
If you have the following root:<br>
<br>
<svg xmlns="<a href="http://www.w3.org/2000/svg" \
target="_blank">http://www.w3.org/2000/svg</a>"><br>
...<br>
<br>
Then, to process that node in XSLT, you need either:<br>
<br>
<xsl:stylesheet xmlns:xsl="<a href="http://www.w3.org/1999/XSL/Transform" \
target="_blank">http://www.w3.org/1999/XSL/Transform</a>"<br>
xmlns="<a href="http://www.w3.org/2000/svg" \
target="_blank">http://www.w3.org/2000/svg</a>"><br>
...<br>
<br>
<xsl:template match="svg"><br>
...<br>
<br>
or<br>
<br>
<xsl:stylesheet xmlns:xsl="<a href="http://www.w3.org/1999/XSL/Transform" \
target="_blank">http://www.w3.org/1999/XSL/Transform</a>"<br>
xmlns:svg="<a href="http://www.w3.org/2000/svg" \
target="_blank">http://www.w3.org/2000/svg</a>"><br>
...<br>
<xsl:template match="svg:svg"><br>
...<br>
<br>
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.<br>
<br>
HTH!<br>
<br>
Andreas<br>
<br>
---------------------------------------------------------------------<br>
To unsubscribe, e-mail: <a href="mailto:fop-users-unsubscribe@xmlgraphics.apache.org" \
target="_blank">fop-users-unsubscribe@xmlgraphics.apache.org</a><br> For additional \
commands, e-mail: <a href="mailto:fop-users-help@xmlgraphics.apache.org" \
target="_blank">fop-users-help@xmlgraphics.apache.org</a><br> <br>
</blockquote></div><br><br clear="all"><br>-- <br>Sam Fuqua<br>ÓÍ ÈÇ 454<br>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic