This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: XSL for element containing mixed content.
- To: XSL List <xsl-list at lists dot mulberrytech dot com>
- Subject: Re: [xsl] XSL for element containing mixed content.
- From: Joerg Pietschmann <joerg dot pietschmann at zkb dot ch>
- Date: Fri, 07 Sep 2001 13:44:22 +0200
- Organization: ZKB
- Reply-To: xsl-list at lists dot mulberrytech dot com
Sandeep Deshpande <san25872@yahoo.com> wrote:
> How do I write XSL for following section of XML file.
>
> <directory>
> Hi I am in a directory.
> <subdirectory>
> Hi I am in a subdirectory.
> <file>
> Hi I am in file.
> </file>
> </subdirectory>
> </Directory>
>
> In the above case if I make a template for 'directory'
> then I can write '<xsl:value-of select ".">',
This construct is defined to return all text in the node
and all subnodes, as you has noted.
It would be easier and more robust to change your XML
structure, for example:
<directory>
<text>Hi I am in a directory.</text>
<subdirectory>
<text>Hi I am in a subdirectory.</text>
<file>
<text>Hi I am in file.</text>
</file>
</subdirectory>
</directory>
Of yourse, if you want to store the name instead of arbitrary
text, it'd be more intuitive to use <name> instead of <text>.
HTH
J.Pietschmann
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list