[Yanel-dev] XML resource patch

Evaldas Taroza etaroza at optaros.com
Wed Jan 16 18:00:52 CET 2008


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=3D"/">
   <xsl:for-each =

select=3D"document('yanelrepo:/en/sitetree.xml')/y:sitetree/y:node">
     <xsl:value-of select=3D"y:name"/>
   </xsl:for-each>
</xsl:template>

However, document('yanelresource:/....') does not work, either there is =

an exception says that "Content is not allowed in prolog" or other =

problems...

WDYT?

Josias Th=F6ny 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=3D"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

-- =

+41 79 616 53 76
Optaros - www.optaros.com
-------------- next part --------------
Index: impl/java/org/wyona/yanel/impl/resources/BasicXMLResource.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- impl/java/org/wyona/yanel/impl/resources/BasicXMLResource.java	(revisio=
n 30438)
+++ impl/java/org/wyona/yanel/impl/resources/BasicXMLResource.java	(working=
 copy)
@@ -198,6 +198,7 @@
             TransformerHandler[] xsltHandlers =3D new TransformerHandler[x=
sltPaths.length];
             for (int i =3D 0; i < xsltPaths.length; i++) {
                 xsltHandlers[i] =3D tf.newTransformerHandler(new StreamSou=
rce(repo.getNode(xsltPaths[i]).getInputStream()));
+                xsltHandlers[i].getTransformer().setURIResolver(new Source=
Resolver(this));
                 passTransformerParameters(xsltHandlers[i].getTransformer()=
);
             }
=20


More information about the Yanel-development mailing list