-- 作者:zhengminxin
-- 发布时间:6/29/2007 11:38:00 AM
--
room.xsl文件内容 <?xml version='1.0'?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"> <xsl:output method="xml" indent="yes" encoding="UTF-8" /> <xsl:template match="/"> <svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" width="1200px" height="250px" viewBox="0 0 400 250" id="RoomsSVG"> <g id="mover" transform="translate(-400,0)"> <xsl:apply-templates select="Room" /> </g> </svg> </xsl:template> <xsl:template match="Room"> <xsl:element name="svg"> <xsl:attribute name="id"> <xsl:value-of select="concat('Room10', @position)" /> </xsl:attribute> <xsl:attribute name="width"> <xsl:value-of select="(10 * @width)" />px </xsl:attribute> <xsl:attribute name="height"> <xsl:value-of select="(10 * @depth)" />px </xsl:attribute> <xsl:attribute name="x"> <xsl:value-of select="concat(((@position - 1) * 400), 'px')" /> </xsl:attribute> <xsl:attribute name="y">0px</xsl:attribute> <xsl:element name="rect"> <xsl:attribute name="id"> <xsl:value-of select="concat('Room10', @position, 'Rect')" /> </xsl:attribute> <xsl:attribute name="width">100%</xsl:attribute> <xsl:attribute name="height">100%</xsl:attribute> <xsl:choose> <xsl:when test="@position='1'"> <xsl:attribute name="fill">#CCCCFF</xsl:attribute> </xsl:when> <xsl:when test="@position='2'"> <xsl:attribute name="fill">#CCFFCC</xsl:attribute> </xsl:when> <xsl:when test="@position='3'"> <xsl:attribute name="fill">#FFCC00</xsl:attribute> </xsl:when> </xsl:choose> <xsl:attribute name="stroke">black</xsl:attribute> <xsl:attribute name="stroke-width">5</xsl:attribute> </xsl:element> <!-- End of rect Element --> <xsl:element name="text"> <xsl:attribute name="id"> <xsl:value-of select="concat('Room10', @position, 'Label')" /> </xsl:attribute> <xsl:attribute name="font-size">24pt</xsl:attribute> <xsl:attribute name="x">55px</xsl:attribute> <xsl:attribute name="y">100px</xsl:attribute> <xsl:attribute name="fill">black</xsl:attribute> Room 10<xsl:value-of select="@position" /> </xsl:element> <!-- End of first text Element --> <xsl:element name="text"> <xsl:attribute name="id"> <xsl:value-of select="concat('Room10', @position, 'Type')" /> </xsl:attribute> <xsl:attribute name="font-size">24pt</xsl:attribute> <xsl:attribute name="x">55px</xsl:attribute> <xsl:attribute name="y">150px</xsl:attribute> <xsl:attribute name="fill">black</xsl:attribute> <xsl:value-of select="@type" /> office </xsl:element> <!-- End of second text Element --> <xsl:element name="a"> <xsl:attribute name="xlink:href">Rooms2ndFloor.html</xsl:attribute> <xsl:element name="text"> <xsl:attribute name="id"> <xsl:value-of select="concat('Room10', @position, 'Link')" /> </xsl:attribute> <xsl:attribute name="font-size">15pt</xsl:attribute> <xsl:attribute name="x">55px</xsl:attribute> <xsl:attribute name="y">200px</xsl:attribute> <xsl:attribute name="fill">black</xsl:attribute> Click to view 2nd Floor </xsl:element> <!-- End of third text Element --> </xsl:element> <!-- End of the <a> Element --> </xsl:element> <!-- End of nested svg Element --> </xsl:template> </xsl:stylesheet>
|