Hello!
I am pretty new to this and strugling with basic stuff.
Here is my problme.
I have this XML document
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="books.xsl"?>
<!DOCTYPE BOOKS[
<!ELEMENT BOOKS (BOOK+)>
<!ELEMENT BOOK (TITLE+,AUTHOR+,PUBLISHED+,DESCRIPTION*)>
<!ELEMENT AUTHOR (#PCDATA)>
<!ELEMENT PUBLISHED (#PCDATA)>
<!ELEMENT DESCRIPTION (#PCDATA)>
]>
<BOOKS>
<BOOK>
<TITLE>XML Step by Step Tutorial</TITLE>
<AUTHOR>Yu Yang</AUTHOR>
<AUTHOR>LI JANG</AUTHOR>
<PUBLISHED>2002</PUBLISHED>
<DESCRIPTION>Excelent XML tutorial for beginners.</DESCRIPTION>
</BOOK>
<BOOK>
<TITLE>SE Java</TITLE>
<AUTHOR>Mike Murach</AUTHOR>
<PUBLISHED>2006</PUBLISHED>
<DESCRIPTION>It is a beginner step by step instructional Java book.</DESCRIPTION>
</BOOK>
</BOOKS>
And this xsl
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="<xslutput method="html"/>
<xsl:template match="/">
<HTML>
<HEAD>
<TITLE>BOOKS</TITLE>
</HEAD>
<BODY BGCOLOR="LightGray">
<p align="center"><font size="20" color="Teal">BOOKS</font></p>
<TABLE border="1" align="center" bgcolor="LightGray">
<TR bgcolor="Teal">
<TH align="center"><FONT SIZE="+2">BOOK</FONT></TH>
<TH align="center"><FONT SIZE="+2">AUTHOR</FONT></TH>
<TH align="center"><FONT SIZE="+2">PUBLISHED</FONT></TH>
<TH align="center"><FONT SIZE="+2">DESCRIPTION</FONT></TH>
</TR>
<xsl:for-each select="//BOOK">
<TR>
<TD align="left"><FONT COLOR="DarkSlateBlue" SIZE="+1"><xsl:value-of select="TITLE"/></FONT></TD>
<TD align="left"><FONT COLOR="DarkSlateBlue" SIZE="+1">
<xsl:value-of select="AUTHOR"/>
<!-- this does not work -->
<BR/>
<xsl:value-of select="AUTHOR"/>
-->
</FONT></TD>
<TD align="center"><FONT COLOR="DarkSlateBlue" SIZE="+1"><xsl:value-of select="PUBLISHED"/></FONT><BR/></TD>
<TD align="left"><FONT COLOR="DarkSlateBlue" SIZE="+1"><xsl:value-of select="DESCRIPTION"/></FONT><BR/></TD>
</TR>
</xsl:for-each>
</TABLE>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>
This XSL read just first AUTHOR
I do not know how I can read second element AUTHOR from xml document using this XSL structure. Any help is appreciated.
Thanks a lot.
I am pretty new to this and strugling with basic stuff.
Here is my problme.
I have this XML document
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="books.xsl"?>
<!DOCTYPE BOOKS[
<!ELEMENT BOOKS (BOOK+)>
<!ELEMENT BOOK (TITLE+,AUTHOR+,PUBLISHED+,DESCRIPTION*)>
<!ELEMENT AUTHOR (#PCDATA)>
<!ELEMENT PUBLISHED (#PCDATA)>
<!ELEMENT DESCRIPTION (#PCDATA)>
]>
<BOOKS>
<BOOK>
<TITLE>XML Step by Step Tutorial</TITLE>
<AUTHOR>Yu Yang</AUTHOR>
<AUTHOR>LI JANG</AUTHOR>
<PUBLISHED>2002</PUBLISHED>
<DESCRIPTION>Excelent XML tutorial for beginners.</DESCRIPTION>
</BOOK>
<BOOK>
<TITLE>SE Java</TITLE>
<AUTHOR>Mike Murach</AUTHOR>
<PUBLISHED>2006</PUBLISHED>
<DESCRIPTION>It is a beginner step by step instructional Java book.</DESCRIPTION>
</BOOK>
</BOOKS>
And this xsl
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="<xslutput method="html"/>
<xsl:template match="/">
<HTML>
<HEAD>
<TITLE>BOOKS</TITLE>
</HEAD>
<BODY BGCOLOR="LightGray">
<p align="center"><font size="20" color="Teal">BOOKS</font></p>
<TABLE border="1" align="center" bgcolor="LightGray">
<TR bgcolor="Teal">
<TH align="center"><FONT SIZE="+2">BOOK</FONT></TH>
<TH align="center"><FONT SIZE="+2">AUTHOR</FONT></TH>
<TH align="center"><FONT SIZE="+2">PUBLISHED</FONT></TH>
<TH align="center"><FONT SIZE="+2">DESCRIPTION</FONT></TH>
</TR>
<xsl:for-each select="//BOOK">
<TR>
<TD align="left"><FONT COLOR="DarkSlateBlue" SIZE="+1"><xsl:value-of select="TITLE"/></FONT></TD>
<TD align="left"><FONT COLOR="DarkSlateBlue" SIZE="+1">
<xsl:value-of select="AUTHOR"/>
<!-- this does not work -->
<BR/>
<xsl:value-of select="AUTHOR"/>
-->
</FONT></TD>
<TD align="center"><FONT COLOR="DarkSlateBlue" SIZE="+1"><xsl:value-of select="PUBLISHED"/></FONT><BR/></TD>
<TD align="left"><FONT COLOR="DarkSlateBlue" SIZE="+1"><xsl:value-of select="DESCRIPTION"/></FONT><BR/></TD>
</TR>
</xsl:for-each>
</TABLE>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>
This XSL read just first AUTHOR
I do not know how I can read second element AUTHOR from xml document using this XSL structure. Any help is appreciated.
Thanks a lot.