[Yanel-dev] XML resource patch

Josias Thöny josias.thoeny at wyona.com
Thu Jan 17 17:54:49 CET 2008


Evaldas Taroza wrote:
> I made a small patch for the GenericXMLResource. I hope this does not 
> brake much. What it allows to do is to refer to different documents 
> inside the XSLT. For instance:
> <xsl:template match="/">
>   <xsl:for-each 
> select="document('yanelrepo:/en/sitetree.xml')/y:sitetree/y:node">
>     <xsl:value-of select="y:name"/>
>   </xsl:for-each>
> </xsl:template>

I checked in your patch. Thank you very much.

> 
> However, document('yanelresource:/....') does not work, either there is 
> an exception says that "Content is not allowed in prolog" or other 
> problems...

Maybe it's including the XML prolog or the DTD?

josias

> 
> WDYT?
> 
> Josias Thöny wrote:
>> Evaldas Taroza wrote:
>>> Ok, maybe I changed too much. What I need is to be able to serialize 
>>> XML resource into pure text. So I introduced TEXT in 
>>> SerializerFactory. If I use HTML serializer I get all the DTD stuff 
>>> prepended, which I don't want...
>>
>> ok, I see.
>> Maybe we could add a property "omit-document-type" or something like 
>> that, as in the attached patch.
>>
>> You could use it in the rc:
>>
>> <serializer key="HTML_TRANSITIONAL">
>>   <omit-xml-declaration>yes</omit-xml-declaration>
>>   <omit-document-type>yes</omit-document-type>
>> </serializer>
>>
>> Would that solve your problem?
> 
> I think this is a good idea to do that.
> 
> Evaldas
> 
> 
> ------------------------------------------------------------------------
> 
> Index: impl/java/org/wyona/yanel/impl/resources/BasicXMLResource.java
> ===================================================================
> --- impl/java/org/wyona/yanel/impl/resources/BasicXMLResource.java	(revision 30438)
> +++ impl/java/org/wyona/yanel/impl/resources/BasicXMLResource.java	(working copy)
> @@ -198,6 +198,7 @@
>              TransformerHandler[] xsltHandlers = new TransformerHandler[xsltPaths.length];
>              for (int i = 0; i < xsltPaths.length; i++) {
>                  xsltHandlers[i] = tf.newTransformerHandler(new StreamSource(repo.getNode(xsltPaths[i]).getInputStream()));
> +                xsltHandlers[i].getTransformer().setURIResolver(new SourceResolver(this));
>                  passTransformerParameters(xsltHandlers[i].getTransformer());
>              }
>  
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Yanel-development mailing list
> Yanel-development at wyona.com
> http://lists.wyona.org/cgi-bin/mailman/listinfo/yanel-development


-- 
Josias Thöny
Wyona - Open Source Content Management
http://www.wyona.com


More information about the Yanel-development mailing list