小编smo*_*ice的帖子

NodeJS Express - 全球唯一请求ID

是否可以定义每个日志语句中包含的唯一请求ID,而无需将记录器交给每个方法/函数调用?

使用的技术:NodeJS,Express,Winston

logging node.js express winston

14
推荐指数
2
解决办法
7651
查看次数

XSLT:按多个项目排序

我有XML数据,例如:

<feed>
  <entry>
    <id>4</id>
    <updated>2011-01-18T16:55:54Z</updated>
    <title>title2</title>
  </entry>
  <entry>
    <id>3</id>
    <updated>2011-01-18T16:55:54Z</updated>
    <title>title1</title>
  </entry>
  <entry>
    <id>2</id>
    <updated>2011-01-18T16:55:54Z</updated>
    <title>title1</title>
  </entry>
  <entry>
    <id>1</id>
    <updated>2011-01-18T16:55:54Z</updated>
    <title>title</title>
  </entry>
</feed>
Run Code Online (Sandbox Code Playgroud)

我需要结果如下:

<feed>
  <entry>
    <id>1</id>
    <updated>2011-01-18T16:55:54Z</updated>
    <title>title</title>
  </entry>
  <entry>
    <id>2</id>
    <updated>2011-01-18T16:55:54Z</updated>
    <title>title1</title>
  </entry>
  <entry>
    <id>3</id>
    <updated>2011-01-18T16:55:54Z</updated>
    <title>title1</title>
  </entry>
  <entry>
    <id>4</id>
    <updated>2011-01-18T16:55:54Z</updated>
    <title>title2</title>
  </entry>
</feed>
Run Code Online (Sandbox Code Playgroud)

基本上我需要XSLT对标题进行排序,然后是ID.我已经制作了一个XSLT,但最后出现的时间较短(使用Xerces):

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:atom="http://www.w3.org/2005/Atom"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" encoding="UTF-8" indent="yes" />

 <xsl:template match="@* | node()">
  <xsl:copy>
   <xsl:apply-templates select="@* | node()" />
  </xsl:copy>
 </xsl:template>

 <xsl:template match="atom:feed">
  <xsl:copy>
   <xsl:apply-templates select="*" />
   <xsl:for-each select="atom:entry">
    <xsl:sort …
Run Code Online (Sandbox Code Playgroud)

xslt xerces

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

express ×1

logging ×1

node.js ×1

winston ×1

xerces ×1

xslt ×1