You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Jason McIntosh <ze...@gmail.com> on 2006/11/05 19:36:55 UTC

sXBL content includes

What's the current functionality status of the "includes" attribute of
the xbl:content element?

Based on what I've learned about xSBL, I would expect the following
simple SVG document to print "This text isn't in a label element."
followed by "This text is within a label element!" However, only the
first line prints. I am using a Squiggle that I built with the latest
SVN trunk sources (revsion 471487).

I am prepared to learn that I'm doing something wrong, and would
appreciate a pointer if that's the case.

<svg
    xmlns="http://www.w3.org/2000/svg" version="1.2"
    xmlns:xbl="http://www.w3.org/2004/xbl"
    xmlns:myNS="http://example.com"
    >
  <defs>
    <xbl:xbl>

      <xbl:definition element="myNS:no-label">
        <xbl:template>
          <text>
            <xbl:content />
          </text>
        </xbl:template>
      </xbl:definition>

      <xbl:definition element="myNS:has-label">
        <xbl:template>
          <text>
            <xbl:content includes="has-label"/>
          </text>
        </xbl:template>
      </xbl:definition>

    </xbl:xbl>
  </defs>

  <g font-size="14pt" font-family="Verdana" transform="translate(10, 35)">
    <myNS:no-label>
      This text isn't in a label element.
    </myNS:no-label>
  </g>

  <g font-size="14pt" font-family="Verdana" transform="translate(10, 65)">
    <myNS:has-label>
      This text is within a label element!
    </myNS:has-label>
  </g>

</svg>

-- 
Jason McIntosh
President and Founder
Volity Games
jmac@volity.com
617-792-3829

Digital Games for Analog People.
http://volity.net

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


Re: Re: Re: Re: sXBL content includes

Posted by Jason McIntosh <jm...@volity.com>.
On 11/5/06, Cameron McCormack <ca...@mcc.id.au> wrote:
>
> Oh that would be because any unknown elements, like myNS:label, won't be
> rendered.  Using myNS:label/text() works.

Indeed it does! Thank you so much. Looks like it's time for me to
relearn my XPath syntax...

-- 
Jason McIntosh
President and Founder
Volity Games
jmac@volity.com
617-792-3829

Digital Games for Analog People.
http://volity.net

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


Re: Re: Re: sXBL content includes

Posted by Cameron McCormack <ca...@mcc.id.au>.
Jason McIntosh:
> I tried this on the text element inside the second xbl:template. Here
> is what that whole shadow tree definition looks like now:
> 
>          <text xmlns:myNS="http://example.com">
>            <xbl:content includes="myNS:label" />
>          </text>
> 
> Unfortunately, while the error has gone away, it's once again silently
> failing to render the text. I've tried poking the XPath statement a
> little, to no success.

Oh that would be because any unknown elements, like myNS:label, won’t be
rendered.  Using myNS:label/text() works.

-- 
Cameron McCormack, http://mcc.id.au/
	xmpp:heycam@jabber.org  ▪  ICQ 26955922  ▪  MSN cam@mcc.id.au

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


Re: Re: Re: sXBL content includes

Posted by Jason McIntosh <jm...@volity.com>.
On 11/5/06, Cameron McCormack <ca...@mcc.id.au> wrote:
>
> Ah right, I remember now: it's because the prefix is resolved inside the
> shadow tree, and the namespace lookup code doesn't cross the "boundary"
> from the shadow tree to the actual document.

That makes sense.

> You can get around this by declaring the
> namespace again on some element inside the shdaow tree (e.g. the
> xbl:content or text element).

I tried this on the text element inside the second xbl:template. Here
is what that whole shadow tree definition looks like now:

          <text xmlns:myNS="http://example.com">
            <xbl:content includes="myNS:label" />
          </text>

Unfortunately, while the error has gone away, it's once again silently
failing to render the text. I've tried poking the XPath statement a
little, to no success.

-- 
Jason McIntosh
President and Founder
Volity Games
jmac@volity.com
617-792-3829

Digital Games for Analog People.
http://volity.net

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


Re: Re: sXBL content includes

Posted by Cameron McCormack <ca...@mcc.id.au>.
Jason McIntosh:
> I tried this, and got this error:
> 
> Invalid XPath expression (myNS:label): "Prefix must resolve to a
> namespace: myNS".
> 
> But the myNS prefix is defined up at the document level! So I don't
> know what's going on there.

Ah right, I remember now: it’s because the prefix is resolved inside the
shadow tree, and the namespace lookup code doesn’t cross the “boundary”
from the shadow tree to the actual document.  It’s not clear what the
proper behaviour should be.  You can get around this by declaring the
namespace again on some element inside the shdaow tree (e.g. the
xbl:content or text element).

> My goal today is to write a game-UI library that will work with Batik,
> and the parts of sXBL that Batik does claim to implement would meet my
> needs, if I could get them to work. If SVG and Batik move to XBL 2
> later, I can just update my library.

Ok.

-- 
Cameron McCormack, http://mcc.id.au/
	xmpp:heycam@jabber.org  ▪  ICQ 26955922  ▪  MSN cam@mcc.id.au

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


Re: Re: sXBL content includes

Posted by Jason McIntosh <ze...@gmail.com>.
On 11/5/06, Cameron McCormack <ca...@mcc.id.au> wrote:
>
> You need to have includes="myNS:label" here, otherwise it doesn't select
> any elements.

I tried this, and got this error:

Invalid XPath expression (myNS:label): "Prefix must resolve to a
namespace: myNS".

But the myNS prefix is defined up at the document level! So I don't
know what's going on there.

> Incidentally, the future of sXBL seems unclear.  My guess is that XBL 2
> will be completed in time for SVG Full 1.2 for it to be used in place of
> sXBL.

My goal today is to write a game-UI library that will work with Batik,
and the parts of sXBL that Batik does claim to implement would meet my
needs, if I could get them to work. If SVG and Batik move to XBL 2
later, I can just update my library.

-- 
Jason McIntosh
President and Founder
Volity Games
jmac@volity.com
617-792-3829

Digital Games for Analog People.
http://volity.net

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


Re: sXBL content includes

Posted by Cameron McCormack <ca...@mcc.id.au>.
Hi Jason.

Jason McIntosh:
>      <xbl:definition element="myNS:has-label">
>        <xbl:template>
>          <text>
>            <xbl:content includes="label"/>
>          </text>
>        </xbl:template>
>      </xbl:definition>

You need to have includes="myNS:label" here, otherwise it doesn’t select
any elements.

Incidentally, the future of sXBL seems unclear.  My guess is that XBL 2
will be completed in time for SVG Full 1.2 for it to be used in place of
sXBL.

Cameron

-- 
Cameron McCormack, http://mcc.id.au/
	xmpp:heycam@jabber.org  ▪  ICQ 26955922  ▪  MSN cam@mcc.id.au

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


Re: sXBL content includes

Posted by Jason McIntosh <ze...@gmail.com>.
Ugh, my apologies; the second binding attempt in the previous example
didn't make any sense and would obviously not work.

Here is what I meant to say, and it still doesn't do what I expect. My
apologies for spamming the list with bogus SVG.

<svg
    xmlns="http://www.w3.org/2000/svg" version="1.2"
    xmlns:xbl="http://www.w3.org/2004/xbl"
    xmlns:myNS="http://example.com"
    >
  <defs>
    <xbl:xbl>

      <xbl:definition element="myNS:no-label">
        <xbl:template>
          <text>
            <xbl:content />
          </text>
        </xbl:template>
      </xbl:definition>

      <xbl:definition element="myNS:has-label">
        <xbl:template>
          <text>
            <xbl:content includes="label"/>
          </text>
        </xbl:template>
      </xbl:definition>

    </xbl:xbl>
  </defs>

  <g font-size="14pt" font-family="Verdana" transform="translate(10, 35)">
    <myNS:no-label>
       This text isn't in a label element.
    </myNS:no-label>
  </g>

  <g font-size="14pt" font-family="Verdana" transform="translate(10, 65)">
    <myNS:has-label>
      <myNS:label>
          This text is within a label element!
      </myNS:label>
    </myNS:has-label>
  </g>

</svg>

-- 
Jason McIntosh
President and Founder
Volity Games
jmac@volity.com
617-792-3829

Digital Games for Analog People.
http://volity.net

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


Re: sXBL content includes

Posted by Jason McIntosh <jm...@volity.com>.
On 11/5/06, Jason McIntosh <ze...@gmail.com> wrote:
>
> Based on what I've learned about xSBL, I would expect the following

I of course mean sXBL.

Allow me to say that this is the most cumbersome eTLA since DSSSL.

-- 
Jason McIntosh
President and Founder
Volity Games
jmac@volity.com
617-792-3829

Digital Games for Analog People.
http://volity.net

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