You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lenya.apache.org by Sean Fulton <fu...@cmu.edu> on 2005/05/24 20:01:27 UTC

XInclude and XPointer

I'm trying to do aggregation of page parts with xinclude. I have a 
pipeline like so:

<map:pipeline>
   <map:match pattern="**/test.html">
      <map:generate type="xpathdirectory" src="content/live/media">
         <map:paramater name="depth" value="2" />
         <map:parameter name="xmlFiles" value="\.xml$" /> 
      </map:generate>
      <map:transform src="xslt/news-listing.xsl" />
      <map:transform type="xinclude" />
      <map:serialize type="xml" /> 
   </map:match>
 </map:pipeline>  


news-listing.xsl looks like this:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 							  xmlns:xi="http://www.w3.org/2001/XInclude"
 							  xmlns:dir="http://apache.org/cocoon/directory/2.0"
 							  xmlns:xhtml="http://www.w3.org/1999/xhtml">

<xsl:template match="/">
  <xsl:apply-templates select="dir:directory" 
xmlns:xi="http://www.w3.org/2001/XInclude" />
</xsl:template>                                                         
                                                                    

<xsl:template match="dir:directory" 
xmlns:xi="http://www.w3.org/2001/XInclude" >

  <xsl:for-each select="dir:directory">
 	<xsl:variable name="url" select="@name" />
	<xi:include href="content/live/media/{$url}/index_en.xml#xpointer(/)">
		<xi:fallback>We're not getting anything</xi:fallback>
	</xi:include>
  </xsl:for-each>
</xsl:template>
</xsl:stylesheet>


The actual xinclude works when I do this:
	<xi:include href="content/live/media/{$url}/index_en.xml#xpointer(/)">

But not if I try to reference anything else with xpointer such as:
	<xi:include href="content/live/media/{$url}/index_en.xml#xpointer(/html)"> or
	<xi:include href="content/live/media/{$url}/index_en.xml#xpointer(/p)">

Anyone know what I am doing wrong?

Thanks.

	Sean



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: XInclude and XPointer

Posted by Sean Fulton <fu...@cmu.edu>.
On 2005-05-24 14:09:13 -0400, Doug Chestnut <dh...@virginia.edu> said:

> Just a quick guess, but could it be a namespace issue?

It seems like it.

do the source docs use a ns, if so try this:
> <xi:include 
> href="content/live/media/{$url}/index_en.xml#xpointer(/xhtml:html)">
> or
> <xi:include href="content/live/media/{$url}/index_en.xml#xpointer(/xhtml:p)">
> 
> Hope this helps :-)
> 
Unfortunately, that doesn't work either :(

	Sean


> --Doug
> 
> 
> Sean Fulton wrote:
> I'm trying to do aggregation of page parts with xinclude. I have a 
> pipeline like so:
>> 
>> <map:pipeline>
>>   <map:match pattern="**/test.html">
>>      <map:generate type="xpathdirectory" src="content/live/media">
>>         <map:paramater name="depth" value="2" />
>>         <map:parameter name="xmlFiles" value="\.xml$" />      </map:generate>
>>      <map:transform src="xslt/news-listing.xsl" />
>>      <map:transform type="xinclude" />
>>      <map:serialize type="xml" />   </map:match>
>> </map:pipeline>
>> news-listing.xsl looks like this:
>> 
>> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>>                               xmlns:xi="http://www.w3.org/2001/XInclude"
>>                               
>> xmlns:dir="http://apache.org/cocoon/directory/2.0"
>>                               xmlns:xhtml="http://www.w3.org/1999/xhtml">
>> 
>> <xsl:template match="/">
>>  <xsl:apply-templates select="dir:directory" 
>> xmlns:xi="http://www.w3.org/2001/XInclude" />
>> </xsl:template>                                                         
>>                                                                   
>> <xsl:template match="dir:directory" 
>> xmlns:xi="http://www.w3.org/2001/XInclude" >
>> 
>>  <xsl:for-each select="dir:directory">
>>     <xsl:variable name="url" select="@name" />
>>     <xi:include href="content/live/media/{$url}/index_en.xml#xpointer(/)">
>>         <xi:fallback>We're not getting anything</xi:fallback>
>>     </xi:include>
>>  </xsl:for-each>
>> </xsl:template>
>> </xsl:stylesheet>
>> 
>> 
>> The actual xinclude works when I do this:
>>     <xi:include href="content/live/media/{$url}/index_en.xml#xpointer(/)">
>> 
>> But not if I try to reference anything else with xpointer such as:
>>     <xi:include 
>> href="content/live/media/{$url}/index_en.xml#xpointer(/html)"> or
>>     <xi:include href="content/live/media/{$url}/index_en.xml#xpointer(/p)">
>> 
>> Anyone know what I am doing wrong?
>> 
>> Thanks.
>> 
>>     Sean
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
>> For additional commands, e-mail: user-help@lenya.apache.org
>> 



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: XInclude and XPointer

Posted by Doug Chestnut <dh...@virginia.edu>.
Just a quick guess, but could it be a namespace issue?
do the source docs use a ns, if so try this:
<xi:include 
href="content/live/media/{$url}/index_en.xml#xpointer(/xhtml:html)">
or
<xi:include 
href="content/live/media/{$url}/index_en.xml#xpointer(/xhtml:p)">

Hope this helps :-)

--Doug


Sean Fulton wrote:
> I'm trying to do aggregation of page parts with xinclude. I have a 
> pipeline like so:
> 
> <map:pipeline>
>   <map:match pattern="**/test.html">
>      <map:generate type="xpathdirectory" src="content/live/media">
>         <map:paramater name="depth" value="2" />
>         <map:parameter name="xmlFiles" value="\.xml$" />      
> </map:generate>
>      <map:transform src="xslt/news-listing.xsl" />
>      <map:transform type="xinclude" />
>      <map:serialize type="xml" />   </map:match>
> </map:pipeline> 
> 
> news-listing.xsl looks like this:
> 
> <xsl:stylesheet version="1.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                               xmlns:xi="http://www.w3.org/2001/XInclude"
>                               
> xmlns:dir="http://apache.org/cocoon/directory/2.0"
>                               xmlns:xhtml="http://www.w3.org/1999/xhtml">
> 
> <xsl:template match="/">
>  <xsl:apply-templates select="dir:directory" 
> xmlns:xi="http://www.w3.org/2001/XInclude" />
> </xsl:template>                                                         
>                                                                   
> <xsl:template match="dir:directory" 
> xmlns:xi="http://www.w3.org/2001/XInclude" >
> 
>  <xsl:for-each select="dir:directory">
>     <xsl:variable name="url" select="@name" />
>     <xi:include href="content/live/media/{$url}/index_en.xml#xpointer(/)">
>         <xi:fallback>We're not getting anything</xi:fallback>
>     </xi:include>
>  </xsl:for-each>
> </xsl:template>
> </xsl:stylesheet>
> 
> 
> The actual xinclude works when I do this:
>     <xi:include href="content/live/media/{$url}/index_en.xml#xpointer(/)">
> 
> But not if I try to reference anything else with xpointer such as:
>     <xi:include 
> href="content/live/media/{$url}/index_en.xml#xpointer(/html)"> or
>     <xi:include href="content/live/media/{$url}/index_en.xml#xpointer(/p)">
> 
> Anyone know what I am doing wrong?
> 
> Thanks.
> 
>     Sean
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
> For additional commands, e-mail: user-help@lenya.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: XInclude and XPointer

Posted by Sean Fulton <fu...@cmu.edu>.
On 2005-05-24 22:23:23 -0400, "Gregor J. Rothfuss" <gr...@apache.org> said:

> Sean Fulton wrote:
> 
>>> <xi:include href="content/live/media/{$url}/index_en.xml
>>>    #xmlns(xhtml=http://www.w3.org/1999/xhtml)xpointer(/xhtml:html)">
> 
>> Thanks. That does work. Now, I want to get at the metadata. Do I have 
>> to include the namespace for both lenya and dc in that url? Does anyone 
>> know a simpler way?
> 
> <xi:include href="content/live/media/{$url}/index_en.xml
>   #xmlns(dc=http://purl.org/dc/elements/1.1/)xpointer(//dc:title)">

Yes it does. Thank you!

> 
> should work
> 
> by the way, lenya seems to be at the forefront of xpointer usage :
> 
> http://www.google.com/search?q=xpointer+namespace&num=3

And now with this thread about xpointer and namespace lenya is sure to 
move up in the google ranks for xpointer and namespace.

Thanks for helping me understand xpointer and namespace. :)

	Sean



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: XInclude and XPointer

Posted by "Gregor J. Rothfuss" <gr...@apache.org>.
Sean Fulton wrote:

>> <xi:include href="content/live/media/{$url}/index_en.xml
>>    #xmlns(xhtml=http://www.w3.org/1999/xhtml)xpointer(/xhtml:html)">

> Thanks. That does work. Now, I want to get at the metadata. Do I have to 
> include the namespace for both lenya and dc in that url? Does anyone 
> know a simpler way?

<xi:include href="content/live/media/{$url}/index_en.xml
  #xmlns(dc=http://purl.org/dc/elements/1.1/)xpointer(//dc:title)">

should work

by the way, lenya seems to be at the forefront of xpointer usage :

http://www.google.com/search?q=xpointer+namespace&num=3

;)

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: XInclude and XPointer

Posted by Sean Fulton <fu...@cmu.edu>.
On 2005-05-24 16:24:31 -0400, Andreas Hartmann <an...@apache.org> said:

> Sean Fulton wrote:
> 
> [...]
> 
>> The actual xinclude works when I do this:
>>     <xi:include href="content/live/media/{$url}/index_en.xml#xpointer(/)">
>> 
>> But not if I try to reference anything else with xpointer such as:
>>     <xi:include 
>> href="content/live/media/{$url}/index_en.xml#xpointer(/html)"> or
>>     <xi:include href="content/live/media/{$url}/index_en.xml#xpointer(/p)">
> 
> 
> You could try
> 
> 
> <xi:include href="content/live/media/{$url}/index_en.xml
>    #xmlns(xhtml=http://www.w3.org/1999/xhtml)xpointer(/xhtml:html)">
> 
> -- Andreas

Thanks. That does work. Now, I want to get at the metadata. Do I have 
to include the namespace for both lenya and dc in that url? Does anyone 
know a simpler way?

	Sean



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: XInclude and XPointer

Posted by Andreas Hartmann <an...@apache.org>.
Sean Fulton wrote:

[...]

> The actual xinclude works when I do this:
>     <xi:include href="content/live/media/{$url}/index_en.xml#xpointer(/)">
> 
> But not if I try to reference anything else with xpointer such as:
>     <xi:include 
> href="content/live/media/{$url}/index_en.xml#xpointer(/html)"> or
>     <xi:include href="content/live/media/{$url}/index_en.xml#xpointer(/p)">


You could try


<xi:include href="content/live/media/{$url}/index_en.xml
   #xmlns(xhtml=http://www.w3.org/1999/xhtml)xpointer(/xhtml:html)">

-- Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org