reading a file as an xsl instruction?

D

Dhurandhar

How can I read a file as a template instruction in an xsl?

Upon matching a template, I need to add the contents of
an entire file in the result tree.

Is that possible?

(sorry if I am a bit fuzzy).

Regards,
D
 
M

Manish Pandit

Dhurandhar said:
(sorry if I am a bit fuzzy).

Yeah, it is kind of fuzzy. Are you trying to use XSLT and transform an
XML document with the XSL ? You can take a look at cocoon/xalan-j XSLT
processor for more info on how to do that.

-cheers,
Manish
 
M

Mike Schilling

Dhurandhar said:
How can I read a file as a template instruction in an xsl?

Upon matching a template, I need to add the contents of
an entire file in the result tree.

Is that possible?

(sorry if I am a bit fuzzy).

1. Write a custom XPath function, or
2. Pass the contents of the file in as the value of an XSLT parameter.
 
T

Tor Iver Wilhelmsen

Dhurandhar said:
Upon matching a template, I need to add the contents of
an entire file in the result tree.

At the top:

<!DOCTYPE stylesheet (etc.) [
<!ENTITY includefile SYSTEM "thefile.xml">
]>

Then, in the template rule:

<xsl:template match="foo">
&includefile;
</xsl:template>
 
D

Dhurandhar

Tor said:
Dhurandhar said:
Upon matching a template, I need to add the contents of
an entire file in the result tree.

At the top:

<!DOCTYPE stylesheet (etc.) [
<!ENTITY includefile SYSTEM "thefile.xml">
]>

Then, in the template rule:

<xsl:template match="foo">
&includefile;
</xsl:template>

That worked, but partially (thanks).
I am finding that in the resulting document, some of the characters are
stripped off. Thus, if
thefile.xml contains something like ${a.b.c}/d/e, the resulting
document only has $/d/e.

Am I missing something?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top