我希望在某些条件通过时显示文本(当文本存在时)。我在使用应用模板时添加了条件
这是我的代码 http://xsltransform.net/gVhD8Ra
预期输出
测试文本
码
<xsl:template match="/">
<hmtl>
<head>
<title>New Version!</title>
</head>
<xsl:apply-templates select="arttextnew/[strong ='GOLD RATE DAILY UPDATE']"/>
</hmtl>
</xsl:template>
<xsl:template match="arttextnew/[strong ='GOLD RATE DAILY UPDATE']">
test text
</xsl:template>
</xsl:transform>
XML
<?xml version="1.0" encoding="UTF-8"?>
<arttextnew>
<page>
<div class="section1">
<div class="Normal">
NEW DELHI:
is probably the most preferred asset for all kinds of investors in India. The jewellery gifted at weddings in India has always been seen as an investment too. The country has been the largest consumer of gold in terms of volume consumption, followed by China and the USA. The
is subject to speculation and volatility in the market. The gold rate changes on daily basis as it depends on various world political and economic factors such as economy of the country, stock market indices, currencies exchange rates, international relations etc.
<br/>
<br/>
<strong>HOW TO BUY GOLD</strong>
<br/>
<br/>
Gold is one asset class which is consumed in many forms. But each one is suited in different scenarios. For instance, a simple gold bar is different from jewellery and investing through gold ETF has its own advantage.
<br/>
<br/>
Take a look at how and when you should invest in gold:
<br/>
<br/>
<strong>1. Gold Jewellery</strong>
<br/>
<br/>
Since Vedic times, gold jewellery has been part of our culture and tradition. Festivals such as Akshaya Tritiya and Dhanteras are considered to be an auspicious time to buy gold. The price of gold jewellery depends on the karat of gold used and making charges (around 5 to 15%). The 22 karat gold is a highest quality gold as it has 91.6% gold mass and is mainly used to make jewellery and ornaments. 18 karat gold includes 75% of the gold mass and this makes it the popular karat for jewellery as it has slightly lower gold rate. It provides ample strength to hold the gemstones, diamonds and emeralds in place. Some jeweller also use 14 karat gold which includes 58.3% gold mass.
<br/>
<br/>
<strong>2. Gold Bar, Coin or Biscuit</strong>
<br/>
<br/>
Gold bar is one of the oldest forms of preserving gold. There is less cost involved than buying gold in the form of jewellery. In fact, it has become a most lucrative form of gifting during festival such as Akshaya Tritiya and Dhanteras. But the price of buying a gold coin is higher than the market rate. Also, banks only sell it and are not allowed to trade by the regulator.
<br/>
<br/>
<strong>3. Gold ETF</strong>
<br/>
<br/>
Exchange Traded Funds (ETF) have been gaining slow acceptance in India and gold ETF has emerged as one of the favourite investments. This is primarily due to a few reasons. Firstly, these are traded on a stock exchange providing high liquidity to investors. Every unit of ETF is equivalent to 1 gram of gold. Secondly, investors do not have to bear high cost unlike physical gold and the underline gold held by institution is also of high purity. Thirdly, the gains are treated as long term after one year and there is no wealth tax like in physical gold.
<br/>
<br/>
<strong>4. Gold Funds</strong>
<br/>
<br/>
Gold mutual fund schemes are identical to any other mutual fund schemes. There are two categories of gold funds -02-2017-02-2017 Gold Fund of Fund and Gold Funds. An FOF invests in gold ETF while gold funds invest in mining companies. Although these have easier option to invest, gold FOF have higher expenses and gold funds have higher risk associated as they invest in stocks.
<br/>
<br/>
<strong>GOLD RATE DAILY UPDATE</strong>
<br/>
<br/>
<strong>JULY 11, 2017:</strong>
Gold today opened at Rs 27,742 on MCX
<br/>
<br/>
<strong>JULY 10, 2017:</strong>
Gold prices went down by 0.26 per cent to Rs 27,711 per 10 grams in futures trade today as participants lightened their bets, tracking a weak movement overseas. Analysts attributed the fall in prices to a weak trend overseas as a relatively solid US jobs data raised hopes for higher US interest rate this year, eroding demand for the precious metal as a safe haven investment.
<br/>
<br/>
<strong>JULY 7, 2017:</strong>
Gold prices ruled steady in a largely quiet trade at the bullion market here today on muted offtake by jewellers and investors even as the metal weakened overseas. Standard gold (99.5 purity) closed at its overnight level of Rs 28,085 per 10 grams. Pure gold (99.9 purity) also settled at its previous level of Rs 28,235 per 10 grams. Globally, gold ticked lower as a stronger US dollar and higher yields weighed on the market ahead of US jobs data later in the day that could give more clues about further rate increases.
<br/>
<br/>
<strong>JULY 6, 2017:</strong>
The gold rates today declined marginally for the eight straight session by Rs 5 per 10 grams due to subdued demand from local jewellers. The Standard gold (99.5 purity) eased by Rs 5 to end at Rs 28,085 per 10 grams from its previous day's closing level of Rs 28,090. Pure gold (99.9 purity) also declined by a similar margin to close at Rs 28,235 per 10 grams as compared to Rs 28,240 previously. Globally, Gold prices ended higher on July 5, getting a boost as downbeat US economic data and North Korea's ballistic-missile test drew investor interest to the precious metal.
<br/>
<br/>
<strong>JULY 5, 2017:</strong>
Gold slumped today, losing Rs 90 to Rs 29,220 per 10 grams, owing to slack demand from local jewellers even as the metal strengthened overseas. However, gold price rose globally 0.23 per cent to USD 1,222.50 an ounce in Singapore. In the national capital, gold of 99.9 per cent and 99.5 per cent purity drifted further lower by Rs 90 each to Rs 29,220 and Rs 29,070 per 10 grams, respectively. The precious metal had lost Rs 100 in the past two days.
<br/>
<br/>
<strong>JULY 4, 2017:</strong>
Gold weakened further at the Indian bullion market today due to lack of demand from stockists and retailers despite higher overseas cues. The standard gold (99.5 purity) fell by Rs 200 to close at Rs 28,135 per 10 grams from July 3rd's closing of Rs 28,335. Pure gold (99.9 purity) also moved down by a similar margin to settle at Rs 28,285 per 10 grams as compared to Rs 28,485 yesterday. Globally, gold prices rose, boosted by haven demand after North Korea spooked investors by test-launching a long-range missile that the regime claims can reach anywhere in the world.
<br/>
<br/>
<strong>JULY 3, 2017:</strong>
Gold fell further by Rs 285 per ten grams at the bullion market today, tracking a weak trend overseas amid slackened demand from local jewellers. Standard gold (99.5 purity) slid by Rs 285 to conclude at Rs 28,335 per 10 grams from last Friday's closing level of Rs 28,620. Pure gold (99.9 purity) also shed by a similar margin to end at Rs 28,485 per 10 grams compared to Rs 28,770 earlier. Globally, gold prices fell, adding to what was the precious metal's first monthly decline since March as a steadying US dollar rebounded from last week's sharp loss and indications for stock gains weighed on haven investments.
<br/>
<br/>
<br/>
.
</div>
</div>
</page>
</arttextnew>
请你检查我的条件,为什么它没有显示文字
答案 0 :(得分:0)
arttextnew/[strong ='GOLD RATE DAILY UPDATE']
是无效的表达。
arttextnew[strong ='GOLD RATE DAILY UPDATE']
会选择arttextnew
,其中子元素名为strong
,其字符串值为&#34; GOLD RATE DAILY UPDATE&#34;。您的输入中没有。
arttextnew[.//strong ='GOLD RATE DAILY UPDATE']
将选择arttextnew
,其中后代元素名为strong
,其字符串值为&#34; GOLD RATE DAILY UPDATE&#34;。
可能有更好的方法来执行此测试 - 您当然不必多次声明相同的条件:http://xsltransform.net/gVhD8Ra/1