{"id":199,"date":"2007-08-22T20:19:19","date_gmt":"2007-08-22T12:19:19","guid":{"rendered":"http:\/\/www.xujiwei.com\/blog\/?p=199"},"modified":"2010-01-29T21:07:27","modified_gmt":"2010-01-29T13:07:27","slug":"variables-and-operator-in-xslt","status":"publish","type":"post","link":"https:\/\/xujiwei.com\/blog\/2007\/08\/variables-and-operator-in-xslt\/","title":{"rendered":"XSL\u4e2d\u7684\u8fd0\u7b97\u7b26\u4e0e\u53d8\u91cf\u540d"},"content":{"rendered":"<p>\u6628\u5929\u5728\u5199XSL\u6a21\u677f\u7684\u65f6\u5019\uff0c\u5728\u6a21\u677f\u4e2d\u4f7f\u7528\u4e86\u4e00\u4e2a\u53d8\u91cf\uff0c\u7ed3\u679c\u5728\u8c03\u8bd5\u7684\u65f6\u5019\u5374\u600e\u4e48\u4e5f\u4e0d\u884c\uff0c\u6211\u7684\u53d8\u91cf\u540d\u662f$ItemCount\uff0c\u7136\u540e\u5728\u6a21\u677f\u4e2d\u4f7f\u7528\u4e86\u8fd9\u4e2a\u53d8\u91cf\u00a0\uff1a<\/p>\n<div class=\"codeHead\">\u7a0b\u5e8f\u4ee3\u7801\uff1a<a href=\"javascript:CopyText($('CODE_6293'));\">[ \u590d\u5236\u4ee3\u7801\u5230\u526a\u8d34\u677f ]<\/a><\/div>\n<div id=\"CODE_6293\" class=\"codeMain\">\n<ul>\n<li>&lt;xsl:value-of\u00a0select=\"Tag[position()\u00a0=\u00a0$ItemCount-1]\"\u00a0\/&gt;<\/li>\n<\/ul>\n<\/div>\n<p>\u5728\u8c03\u8bd5\u65f6\u5374\u603b\u662f\u63d0\u793a\u201c\u65e0\u6cd5\u89e3\u6790\u5230\u53d8\u91cf\u6216\u53c2\u6570\u00a0'ItemCount-1'\u7684\u5f15\u7528\u3002\u53d8\u91cf\u6216\u53c2\u6570\u53ef\u80fd\u6ca1\u6709\u88ab\u5b9a\u4e49\uff0c\u6216\u5b83\u53ef\u80fd\u4e0d\u5728\u8303\u56f4\u5185\u3002\u201d\uff0c\u6211\u5c31\u5947\u602a\u4e86\uff0c\u8fd9\u540d\u5b57\u660e\u660e\u662f\u5bf9\u7684\uff0c\u600e\u4e48\u4f1a\u6709\u9519\u5462\uff0c\u7136\u540e\u5c31\u53c8\u5728\u53d8\u91cf\u5b9a\u4e49\u7684\u5730\u65b9\u628a\u53d8\u91cf\u540d\u7ed9\u590d\u5236\u8fc7\u6765\uff0c\u770b\u770b\u8fd8\u662f\u4e0d\u662f\u4f1a\u51fa\u9519\uff0c\u7ed3\u679c\u8fd8\u662f\u4e00\u6837\u7684\u9519\u8bef\u3002<\/p>\n<p>\u8fd9\u4e0b\u90c1\u95f7\u4e86\uff0c\u61d2\u5f97\u4f3a\u5019\u4e86\uff0c\u628a\u4e1c\u897f\u6254\u4e00\u8fb9\uff0c\u73a9\u53bb\u4e86~<\/p>\n<p>\u4eca\u5929\u60f3\u5230\u8fd9\u4e2a\u4e8b\uff0c\u518d\u4e0d\u884c\u8fd9\u4e2a\u6a21\u677f\u603b\u662f\u8981\u5199\u5b8c\u7684\uff0c\u4e8e\u662f\u53c8\u5f00\u4e86EditPlus\uff0c\u627e\u5230\u90a3\u4e00\u53e5\uff0c\u5c31\u5728\u60f3\u600e\u4e48\u6539\u5b83\uff0c\u7a81\u7136\u8111\u5b50\u91cc\u6765\u4e86\u4e00\u70b9\u70b9\u7075\u5149\uff0c\u5728\u51cf\u53f7\u7684\u4e24\u8fb9\u5404\u52a0\u4e86\u4e00\u4e2a\u534a\u89d2\u7a7a\u683c\uff0cFirefox\u91cc\u6253\u5f00\uff0cbingo\uff01\u6b63\u786e\u6267\u884c\u3002<\/p>\n<p>\u5728\u89e3\u51b3\u4e86\u8fd9\u4e2a\u95ee\u9898\u4e4b\u540e\u624d\u60f3\u5230\uff0c\u77ed\u5212\u7ebf\u4e5f\u5c31\u662f\u201c-\u201d\u5728XML\u91cc\u662f\u7b26\u5408\u547d\u4ee4\u89c4\u8303\u7684\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u6211\u5728\u5199\u6210\u201c$ItemCount-1\u201d\u7684\u65f6\u5019\uff0cXSL\u00a0Parser\u00a0\u628a\u201c$ItemCount-1\u201d\u8ba4\u4e3a\u662f\u4e00\u4e2a\u53d8\u91cf\uff0c\u800c\u4e0d\u4f1a\u8ba4\u4e3a\u662f\u4e00\u4e2a\u8868\u8fbe\u5f0f\uff0c\u56e0\u6b64\uff0c\u5c31\u4f1a\u63d0\u793a\u627e\u4e0d\u5230\u53d8\u91cf\uff0c\u51fa\u9519\u3002<\/p>\n<p>\u627e\u5230\u95ee\u9898\u7684\u539f\u56e0\u6240\u5728\uff0c\u5c31\u597d\u89e3\u51b3\u4e86\uff0c\u76f4\u63a5\u628a\u51cf\u53f7\u7ed9\u72ec\u7acb\u51fa\u6765\uff1a<\/p>\n<div class=\"codeHead\">\u7a0b\u5e8f\u4ee3\u7801\uff1a<a href=\"javascript:CopyText($('CODE_7255'));\">[ \u590d\u5236\u4ee3\u7801\u5230\u526a\u8d34\u677f ]<\/a><\/div>\n<div id=\"CODE_7255\" class=\"codeMain\">\n<ul>\n<li>&lt;xsl:value-of\u00a0select=\"Tag[position()\u00a0=\u00a0$ItemCount\u00a0-\u00a01]\"\u00a0\/&gt;<\/li>\n<\/ul>\n<\/div>\n<p>\u89e3\u51b3\u95ee\u9898\uff0c\u7ee7\u7eed\u5199\u6a21\u677f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6628\u5929\u5728\u5199XSL\u6a21\u677f\u7684\u65f6\u5019\uff0c\u5728\u6a21\u677f\u4e2d\u4f7f\u7528\u4e86\u4e00\u4e2a\u53d8\u91cf\uff0c\u7ed3\u679c\u5728\u8c03\u8bd5\u7684\u65f6\u5019\u5374\u600e\u4e48\u4e5f\u4e0d\u884c\uff0c &hellip;<\/p>\n<p class=\"read-more\"><a href=\"https:\/\/xujiwei.com\/blog\/2007\/08\/variables-and-operator-in-xslt\/\">\u7ee7\u7eed\u9605\u8bfb &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[11],"tags":[67,115],"_links":{"self":[{"href":"https:\/\/xujiwei.com\/blog\/wp-json\/wp\/v2\/posts\/199"}],"collection":[{"href":"https:\/\/xujiwei.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xujiwei.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xujiwei.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/xujiwei.com\/blog\/wp-json\/wp\/v2\/comments?post=199"}],"version-history":[{"count":0,"href":"https:\/\/xujiwei.com\/blog\/wp-json\/wp\/v2\/posts\/199\/revisions"}],"wp:attachment":[{"href":"https:\/\/xujiwei.com\/blog\/wp-json\/wp\/v2\/media?parent=199"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xujiwei.com\/blog\/wp-json\/wp\/v2\/categories?post=199"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xujiwei.com\/blog\/wp-json\/wp\/v2\/tags?post=199"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}