<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/shop">
<shop>
<xsl:apply-templates select="offer"/>
</shop>
</xsl:template>
<xsl:template match="offer">
<offer>
<name>
<xsl:value-of select="name"/>
</name>
<category>
<xsl:variable name="category_id" select="categoryid"/>
<xsl:value-of select="/shop/categories/category[@id = $category_id]/text()"/>
</category>
</offer>
</xsl:template>
</xsl:stylesheet>
<shop>
<offer>
<name>Product Name</name>
<category>test</category>
</offer>
</shop>
function getUsdt() {
var fetch = UrlFetchApp.fetch('https://garantex.org/trading/usdtrub', {muteHttpExceptions: true});
if (fetch) {
return fetch.getContentText().match(new RegExp(/exchangers":{"index":{"ask":\[{"id":\d+,"price":"\d+.\d+","volume":"\d+.\d+","usdt_price":"(\d+.\d+)",/, 'i'))[1];
}
return '';
}
=IMPORTXML(A1; "//ul[@class='tb-thumb tb-clearfix']/li[position() = 1]/div/a/img/@data-src")
<root>
<elem>мошка</elem>
<elem>кошка</elem>
<elem>окрошка</elem>
</root>
/root/elem[contains(., 'ошка')]
Element='<elem>мошка</elem>'
Element='<elem>кошка</elem>'
Element='<elem>окрошка</elem>'
/root/elem[. = 'кошка']
XPath result:
Element='<elem>кошка</elem>'