srkumar Posted January 7, 2008 Share Posted January 7, 2008 Hii..I am trying to transform xml files through xslt. I am having an element <people> in two xml files. I have linked all xml files in one xml file and import all xsl files in one xsl file.XML1:<people><head>People</head><list><listitem><p>Paleo-Indians</p></listitem><listitem><p>Archaic Indians</p></listitem></list></people>XSL1:<xsl:template match="lesson/opener/people"><xsl:element name="sidebar"><xsl:attribute name="render">required</xsl:attribute><xsl:apply-templates/></xsl:element></xsl:template>XML2<people> is the root node for this xml.XSL2:<xsl:template match="people"><level><xsl:attribute name="class">People</xsl:attribute><xsl:apply-templates/></level></xsl:template>The output is: (The style which i have given in the xsl2 is applied to xml1)<level class="People"><hd>People</hd><list><li><p>Paleo-Indians</p></li><li><p>Archaic Indians</p></li></list></level>Thanks in Advance,srkumar Link to comment Share on other sites More sharing options...
boen_robot Posted January 10, 2008 Share Posted January 10, 2008 From those portions, I could only suppose that the first template is simply never applied.The first template would only match a "people" element, if it is located in a "opener" element, located in a "lesson" element. The second is applyed to every "people" element, regardless of its location.Since you only have a "people" element in both of your XMLs, only the second template ever gets applied. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.