Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Include contents of a text file

Status
Not open for further replies.

jeffward

MIS
Jul 3, 2002
33
0
0
GB
I am using an xsl stylesheet to output my XML to HTML and would like to conditionally include the contents of a text file, for example: -

....html content here...

<xsl:if test="something='true'">
show contents of .txt file here
</xsl:if>

....html content here...
 
This is not possible just using XSL. XSL can only deal with XML files. If you converted your text file to XML there would be no problem:
Code:
<xsl:if test="something = true()">
  <xsl:value-of select="document('mytextfile.xml')"/>
</xsl:if>

Jon

"Asteroids do not concern me, Admiral. I want that ship, not excuses.
 
You could use an iframe, or textarea to show the text...
Code:
<xsl:if test="File">
  <iframe src="{File}" frameborder="0"></iframe>
</xsl:if>

But that's just in a web browser...

Visit My Site
PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top