我的本地驱动器中有两组文件夹,其中一个文件夹包含多个 XML 文件(D:/Web_Crawlling/Publication/XML),另一个包含多个 TXT 文件,具有 UTF-8 保存模式(D:/Web_Crawlling/Publication/PDF) . <article-url url="http://www.iea.org/publications/freepublications/publication/slt_eu.pdf">
每个 XML 文件都有一个带有属性的元素,@url
该属性表示要合并的文本文件,在这种情况下它是“ slt_eu.pdf.text
”。
我想在<body><para/></body>
我的 XML 文件的元素中合并“slt_eu.pdf.text”文件的文本。我可以合并一些文件,但是当通讯者 TXT 文件有任何非 UTF-8 字符时,我的这个脚本正在创建 0 字节大小的文件。我想跳过此错误以避免创建空文件。
错误描述:
未解析的文本文件包含 XML 中的非法字符(行=18 列=2 值=十六进制 2)
XSLT 引擎:
撒克逊-EE 9.2.0.3
输入 xml:
<article version="1.2.0">
<item-info>
<iid/>
<site-owner>International Energy Agency</site-owner>
<copyright>© 2013 OECD/IEA</copyright>
<article-url url="http://www.iea.org/publications/freepublications/publication/act_locally.pdf">http://www.iea.org/publications/freepublications/publication/name,3632,en.html</article-url>
</item-info>
<head>
<dochead>Publication</dochead>
<title>Act Locally, Trade Globally - Emissions Trading for Climate Policy</title>
<abstract>
<para>
Climate policy raises a number of challenges for the energy sector, the most significant being the transition from a high to a low-CO2 energy path in a few decades. Emissions trading has become the instrument of choice to help manage the cost of this transition, whether used at international or at domestic level. Act Locally, Trade Globally, offers an overview of existing trading systems, their mechanisms, and looks into the future of the instrument for limiting greenhouse gas emissions.</para>
</abstract>
</head>
<body>
<para/>
</body>
</article>
act_locally.pdf.text
187
161. Goldberg and Baumert, 2004. For a discussion, see Philibert 2005a.
169-210.qxd 2/11/05 10:22 Page 187
BROADENING AND DEEPENING
these targets, as a percentage of actual emissions, moderate required
abatement fluctuations relative to that of fixed or GDP-indexed targets.
In practice, however, countries would demonstrate domestic reductions,
proving that emissions would have been higher by the agreed
percentage in the absence of the target. This would require
constructing a baseline of emission trends in the absence of the
country’s actions. As with the calculation of baselines and additionality
under project-based mechanisms, this demonstration may encounter
technical and political difficulty. Worse, the uncertainty on the delivery
of any surplus allowances will be resolved only after the commitment
period. This makes this option probably less market-friendly than others.
Under a regime of allowances and endowments,162 each participating
country would:
Require domestic energy producers to hold an annual emission
allowance for each tonne of carbon embodied in their energy
production, sales or imports.
Issue perpetual emissions “endowments” of annual emission rights
equal to a fraction of emissions during a base period.
Potentially provide additional annual allowances to firms within its
borders at a stipulated price (set at USD 2.7/tCO2).
Create domestic markets for perpetual endowments and annual
allowances. These would involve no international trade, but the
common price for annual allowances would guarantee short run
economic efficiency.
Designed for both developed and developing nations, this regime
calculates endowments volume specific to each. Developed countries
would receive emissions endowments based on their Kyoto targets.
Developing countries would receive emissions endowments equal to
their current emissions plus an agreed percentage. Therefore, in the
5
188
162. McKibbin and Wilcoxen, 2002.
169-210.qxd 2/11/05 10:22 Page 188
short run, the price of annual allowances would be zero in developing
countries. The allowance price will equalise over time, as developing
countries’ ability to pay rises. The distinction between annual
allowances and long-term endowments should set a long term price
signal without excessive short-term cost.
Long-term permits163 could be used to cover emissions at any time
during a long commitment period, perhaps from 2010 to 2070. This
extended period should allow agents to identify the most efficient
timing of emission abatement. Authorised borrowing between
successive shorter periods would provide the same time flexibility.
Box 11 on page 112 illustrates why time flexibility may not be
detrimental to the environmental integrity of a greenhouse gas trading
regime. Banking has proven an effective tool to smooth price variations
and avoid risk of non-compliance. Its absence in the RECLAIM NOx
trading programme exacerbated allowance price increases. Lower
expected costs due to time flexibility may facilitate the adoption of
more ambitious targets at the onset.
International emissions trading under the Kyoto Protocol allows for
limited time flexibility in two forms: the five-year commitment period,
to smooth year-to-year climate or economic variability; and the
possibility to bank unused allowances.164 Complete time flexibility,
however, would require both borrowing and banking to allow optimally
timed investment in abatement. A mechanism familiar to controversy,
borrowing presents the obvious risk that sources will indefinitely defer
investment. As with long-term targets, this risk increases in the absence
of strong enforcement mechanisms. This default is perhaps most likely
in the international arena where regime participants are sovereign
nations. In the end, the market may provide the same service as
borrowing – a source buys allowances to meet its current deficit and
sells its surplus future allowances under a forward contract. This leaves
BROADENING AND DEEPENING
5
189
163. Peck and Teisberg, 2003.
164. Article 3.13 of the Kyoto Protocol.
169-210.qxd 2/11/05 10:22 Page 189
BROADENING AND DEEPENING
the compliance risk with the source, where it belongs, while borrowing
transfers the consequences of non-compliance form the source to the
environment or the government.
It is not certain that the above options would fare better than dynamic,
non-binding, and sector-wide targets to encourage participation of
developing countries in international emissions trading.
Developing Economies’ Circumstances
Institutional capabilities
A global regime must engage developing nations. Beforehand, system
architects should assess the institutional capacity of developing
economies to participate in international emissions trading and the
risks arising from insufficient capacity, were they to participate. We
addressed in the above the risk on economic development and
solutions to it. Other risks are likely to remain.
If transparency, accurate monitoring, a functional legal system, and
realistic incentives to trade are scarce in countries with economies in
transition, “the problems run much deeper in the developing world”.165
In developing nations, one finds few people with the necessary skills
and experience to implement and monitor sophisticated policies; skilled
labour is concentrated in cities rather than field posts; monitoring
equipment is in short supply; even baseline data are unreliable; and
informal and even institutionalised corruption runs rampant.
Greenspan Bell suggests that it may be impossible “to expect that
countries only beginning the process of environmental protection can
start with the most difficult environmental instruments.”
As Baumert et al. (2003) also note, the success of trading systems
“requires competitive markets and other conditions that, in reality, may
5
190
165. Greenspan Bell, 2003.
169-210.qxd 2/11/05 10:22 Page 190
prove elusive, especially within the confines of international treaty law
where participation and compliance cannot be assured.” Further, “if
cross-border financial flows from trading turn out to be significant, then
it does not necessarily follow that revenues would be used domestically
for socially beneficial purposes, such as poverty alleviation or helping
countries adapt to adverse climate impacts.”
There are no easy answers to such questions. The need for a working
legal system to back emissions trading seems obvious. Countries or
entities now holding valuable allowances could be tempted to sell
without delivering corresponding reductions, unless strong enforcement
measures are in place. On the other hand, the cost-effectiveness of
emissions trading would exert a lower pressure on the compliance
regime of any environmental policy and lower the probability of non-
compliance by offering cheap compliance options.
According to Willems and Baumert (2003), the form of future targets
may dictate institutional needs of emissions trading: “Fixed, legally-
binding, comprehensive targets certainly put the strongest pressure on
the domestic policy setting to create the institutional conditions to meet
them. Dynamic targets or targets with price caps somewhat reduce
these capacity needs by reducing a source of uncertainty inherent in
achieving a fixed target. Yet, they have new features which may create
additional institutional capacity requirements. Sectoral targets and non-
binding targets unequivocally reduce some of the institutional needs, by,
respectively, reducing the scope of the target and limiting capacities
needed to make sure the target is met”.
To participate efficiently in carbon markets and mitigate GHG
emissions, economies in transition and developing countries must build
institutional capacity in environmental policy. As energy statistics could
be the basis on which countries define their trading opportunities and
needs, energy authorities may have an important role to play. At the
activity level, the capacity limitations suggest focusing on sectors with
relatively sophisticated management such as the electricity generators
and petroleum producers/distributors.
BROADENING AND DEEPENING
5
191
169-210.qxd 2/11/05 10:22 Page 191
BROADENING AND DEEPENING
Energy use in developing countries
Developing countries’ rapid construction of new infrastructure and high
energy and economies of high energy and carbon intensities (see
figure 12 below) drive the common expectation of their massive supply
of cheap emission reductions. However, structural differences between
economies and various economic efficiencies cannot be solely
attributed to energy conservation. A comparison of intensities on the
basis of purchasing power parities (PPP), instead of exchange rates,
illustrates this point (same figure).
FIGURE 12
CO2 intensities of GDP for selected countries
XSLT:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="XMLFolder">D:/Web_Crawlling/Publication/XML</xsl:param>
<xsl:param name="PDFName" select="tokenize(article/item-info/article-url/@url,'/')[last()]"/>
<xsl:param name="XMLName" select="tokenize(base-uri(.),'/')[last()]"/>
<xsl:param name="PDFNameWithoutExtension" select="replace($PDFName, '[\.][pP][dD][fF]', '')"/>
<xsl:template match="article">
<xsl:param name="URI-To-Save"
select="concat('file:///',substring-before($XMLFolder, '/XML'),'/output/',$XMLName)"/>
<!--<xsl:result-document href="{$URI-To-Save}" method="xml" encoding="UTF-8"
doctype-system="../biofuels120.dtd" indent="no">-->
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
<!--</xsl:result-document>-->
</xsl:template>
<xsl:template match="element()">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="article-url">
<article-url>
<xsl:apply-templates/>
</article-url>
</xsl:template>
<xsl:template match="body">
<xsl:choose>
<xsl:when test="ends-with(lower-case($PDFName), '.pdf')">
<xsl:variable name="TextURI"
select="concat('file:///',substring-before($XMLFolder,'/XML'), '/PDF/', $PDFName,'.txt')"/>
<xsl:variable name="PDFBodyText" select="normalize-space(unparsed-text($TextURI, 'UTF-8'))"/>
<xsl:copy>
<para>
<xsl:value-of select="$PDFBodyText"/>
</para>
</xsl:copy>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
请帮助我避免此错误。