[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] Basic xsl:choose question
Subject: [xsl] Basic xsl:choose question From: Meir <umen@xxxxxxxxxxxxxxxx> Date: Tue, 18 Jun 2002 00:08:48 -0700 |
Hello list again im trying to learn the concepts of xsl , with no much luck here .. im trying to perform simple choose operation , i have this xsl .. ---------------------------------------------------------------------------- ---------------------- <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:for-each select="/CdList//*"> <xsl:call-template name="print"/> </xsl:for-each> </xsl:template> <xsl:template name="print"> <xsl:choose> <xsl:when test="name()[@type='father']"> <------------------------------------here is the problem <span style="border:'1px solid red';width:auto"> <xsl:value-of select="name()"/><xsl:text>=</xsl:text> <xsl:value-of select="./@id"/> </span> </xsl:when> <xsl:otherwise> <span style="border:'1px solid black';width:auto"> <xsl:value-of select="name()"/><xsl:text>=</xsl:text> <xsl:value-of select="./@id"/> </span> </xsl:otherwise> </xsl:choose> <br/> </xsl:template> </xsl:stylesheet> ---------------------------------------------------------------------------- ------------------ here is the xml file ---------------------------------------------------------------------------- ------------------ <?xml version='1.0'?> <CdList> <Dir id="flash" type="father"> <File id="battletank.zip" type="child"> <File id="flashquest.zip" type="child"> <File id="3d.fla" type="child"> <File id="3d.swf" type="child"> <File id="3D_Engin-KStor-189.zip" type="child"> <Dir id="1" type="father"> <File id="level1.txt" type="child"> <File id="flash_quest.swf" type="child"> <File id="level2.txt" type="child"> <File id="level3.txt" type="child"> <File id="level4.txt" type="child"> <File id="FKSingapore.txt" type="child"> </Dir><Dir id="3D_Engin" type="father"> <File id="3DengineForDummies.fla" type="child"> <File id="3DengineForDummies.swf" type="child"> <File id="actionscriptsummary.swf" type="child"> <File id="button.jpg" type="child"> <File id="line.jpg" type="child"> <File id="rotating menu.html" type="child"> <File id="TheWayWeDoIt.jpg" type="child"> </Dir> </Dir> </CdList> as you can see im trying to warp the node that its type == 'father' in red div , and if its not its type == 'father' to black . but with no luck what im doing wrong here ? tnx XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Re: XSL getting started (, Chuck White | Thread | Re: [xsl] Basic xsl:choose question, Antonio Fiol |
Re: [xsl] Template priority, Peter Davis | Date | Re: [xsl] Basic xsl:choose question, Meir |
Month |