0

I am writing beginner's XSL template for an xml which look like this :-

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<Data xmlns=“link1” xmlns:dmd=“Link2”>
    <Record>
    <dmd:IndexEntry indexKey="DEPARTMENT" entryKey="Management" text="Management"/>
    <PCI>
        <PREFIX></PREFIX>
        <FNAME> </FNAME>
        <MNAME> </MNAME>
        <LNAME></LNAME> 
    </PCI>
    <TEACH> 
       <CLASS> </CLASS>
       <YEAR> </YEAR>
       <SEM> </SEM>
    </TEACH>
    <TEACH> “some data2” </TEACH>
    <TEACH> “some data3” </TEACH>
</Record>
</Data>

I want to fetch all information of tag "TEACH". I use this to do that :-

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="Data/Record">
    Hello from XSLT!
    <xsl:for-each select="TEACH">
      <xsl:value-of select="YEAR"/>
      <xsl:value-of select="CLASS"/>
      <xsl:value-of select="SEM"/>
    </xsl:for-each>
</xsl:template>
</xsl:stylesheet>

However, when tested with Firefox,it returns the complete XML and doesn't print 'Hello from XSLT' and Google Chrome displays blank screen. I believe the match clause fails thats why it displays blank screen. But the address Data/Record looks fine to me.

user2714823
  • 607
  • 5
  • 15
  • 29

0 Answers0