Unexpected identifier Jest Vue SVG - unit-testing

I've had this error during running jest on my Vue. I run jest command, and get the error below.
If I remove the svg element in the component. It's working fine
Error message
FAIL test/Header.spec.js
● Test suite failed to run
/Users/jakzaizzat/Code/taiger/kwa/kcp-admin-ui/node_modules/#babel/runtime-corejs2/helpers/esm/defineProperty.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import _Object$defineProperty from "../../core-js/object/define-property";
^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Unexpected identifier
19 | />
20 | <path
> 21 | d="M15.9999 0L0 8.5541V8.77758V27.0448L16.0001 35.5984L32 27.045V8.5541L15.9999 0ZM16.4239 25.007L18.6367 26.3025L21.1325 24.9877L21.5461 25.7729L18.614 27.3176L15.9848 25.7781L13.3554 27.3176L10.4233 25.7729L10.8369 24.9877L13.3325 26.3025L15.5364 25.0122L15.5358 22.9129L10.7279 19.9154V16.1301L4.71654 13.6018L5.06044 12.7836L11.6154 15.5405V19.1554H20.353V15.5405L26.908 12.7836L27.2519 13.6018L21.2407 16.1301V19.9155L16.4231 22.9197L16.4239 25.007Z"
| ^
22 | fill="white"
23 | />
24 | </svg>
Header.spec.js
import Header from "../src/components/shared/Card.vue";
import {mount} from "#vue/test-utils";
describe('Header.vue', () => {
test('render header navigation', () => {
const wrapper = mount(Header);
expect(wrapper.isVueInstance()).toBeTruthy()
});
});
Header.vue
<div class="px-4">
<router-link
to="/"
class="logo"
>
<svg
width="32"
height="36"
viewBox="0 0 32 36"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M15.9849 22.1472L19.3588 20.043H12.6101L15.9849 22.1472Z"
fill="white"
/>
<path
d="M15.9999 0L0 8.5541V8.77758V27.0448L16.0001 35.5984L32 27.045V8.5541L15.9999 0ZM16.4239 25.007L18.6367 26.3025L21.1325 24.9877L21.5461 25.7729L18.614 27.3176L15.9848 25.7781L13.3554 27.3176L10.4233 25.7729L10.8369 24.9877L13.3325 26.3025L15.5364 25.0122L15.5358 22.9129L10.7279 19.9154V16.1301L4.71654 13.6018L5.06044 12.7836L11.6154 15.5405V19.1554H20.353V15.5405L26.908 12.7836L27.2519 13.6018L21.2407 16.1301V19.9155L16.4231 22.9197L16.4239 25.007Z"
fill="white"
/>
</svg>
</router-link>
</div>
Any idea what is the cause of this issue?

Related

How to keep track of position from a template to a different template (2)?

Follow on question to: https://stackoverflow.com/questions/71635891/how-to-keep-track-of-position-from-a-template-to-a-different-template?noredirect=1#comment126614972_71635891
My new problem is, there could be more than one simplePath in a jump and I want all simplePath inside a jump to start
from the same position. My current is issue is that I'm not competent enough to translate my current idea into XSL, I added in comment in the XSLT code what I'm trying to achieve
D --- E --- F K --- L --- M --- N --- O
/ \ /
A --- B --- C--- / \ -- J ---/
\ / \
\ / \
G --- H --- I Q --- R --- S
<root>
<simplePath>
<point>A</point>
<point>B</point>
<point>C</point>
</simplePath>
<jump>
<simplePath>
<point>D</point>
<point>E</point>
<point>F</point>
</simplePath>
<simplePath>
<point>G</point>
<point>H</point>
<point>I</point>
</simplePath>
</jump>
<simplePath>
<point>J</point>
</simplePath>
</root>
expected output
A : 0
B : 50
C : 100
D : 300
E : 350
F : 400
Dbis : 300
Ebis : 350
Fbis : 400
G : 600
poor attempt :
<xsl:template match="/root">
<xsl:call-template name="process">
<xsl:with-param name="points" select=".//point"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="process">
<xsl:param name="points" />
<xsl:param name="total" select="0"/>
<xsl:param name="savePos" select="0"/>
<!-- new param -->
<!-- output -->
<xsl:value-of select="boolean($points[1]/ancestor::jump)"/>
<xsl:value-of select="$points[1]"/>
<xsl:text> : </xsl:text>
<xsl:value-of select="$total"/>
<!-- recursive call -->
<xsl:if test="count($points) > 1">
<xsl:text>
</xsl:text>
<xsl:call-template name="process">
<xsl:with-param name="points" select="$points[position() > 1]"/>
<xsl:with-param name="total" select="if(boolean($points[1]/ancestor::jump) != boolean($points[2]/ancestor::jump)) then $total + 200 else $total + 50"/>
<!-- my "attempt" -->
<!-- I want to save the pos of total IF it's the first point of the first simplePath in a Jump -->
<xsl:with-param name="savePos" select=""/>
<!-- Next, I will add a new "if condition" here
<xsl:with-param name="total" select="if(boolean($points[1]/ancestor::jump) != boolean($points[2]/ancestor::jump))
then
>>>>if I'm not in the first simplePath of "jump", and it's the first "point" of this "simplePath" then
$total = $savePos
else
$total + 200
else
$total + 50"/>
- -->
</xsl:call-template>
</xsl:if>
</xsl:template>

Finding number of unique occurrences of text within xml tag in python 2.6

I am trying to find number of unique occurrences of some text within one xml tag and display the same in one of the columns in a csv file.
My Xml file looks somewhat like this:
<start>
<tag1> ..... </tag1>
<main>
<number> 685 </number>
<text> hi..some text...[]para01 |...</text>
</main>
<main>
<number> 67 </number>
<text> hi..some text...[]para01 |..</text>
</main>
<main>
<number> 75 </number>
<text> hi..some text...[]para02 |...</text>
</main>
<main> .......
I want to find the number of times each text after bracket is occurring (within each main tag), example para01 is seen 2 times, para02 1 time and so on.
What I tried:
tree = ET.parse(file)
root=tree.getroot()
with open(csvfile, 'a') as f:
writer=csv.writer(f, delimiter=', ')
writer.writerow(['number', 'para', 'count'])
lis = []
for child in root.findall('main'):
num = child.find('number').text
para = re.findall(r"\[] (.*?)\| ", child.find('text').text)
lis.append("" .join(para))
res = dict((i, lis.count(i)) for i in lis)
for key, value in res.items():
r.append([key, value])
r = [num, para, [key, value])
writer.writerow(r)
However I seem to be getting result very different from what I want:
number para. Count
685 para01 para01:2
67 para01 para01:2
75 para02 para02:1
What can I change in my code to get the above output?
Putting aside the csv aspect, to get to your target rows, try something like this:
trgt_txts = root.findall(".//text")
trgt_nums = root.findall(".//number")
txts = []
nums = []
for txt in trgt_txts:
target = txt.text.split(']')[1].split(' |' )[0]
txts.append(target)
for n in trgt_nums:
nums.append(n.text.strip())
for par in set(txts):
for p,n in zip(txts,nums):
if p == par:
print(n,par,par+':'+str(txts.count(par)))
Output:
75 para02 para02:1
685 para01 para01:2
67 para01 para01:2

Failed to find an element in selenium python

I using selenium in python2. And I want to find an element using (driver.find_elements_by_class_name())
but, no result from that code. but, if I try to find elements using (driver.find_element_by_class_name()), I get error message.
this is some my code:
def test():
driver.get('https://mbasic.facebook.com/aldhy.tompo')
button_lainnya = driver.find_element_by_link_text('Lainnya')
Class = button_lainnya.get_attribute('class')
print Class
all_button = driver.find_elements_by_class_name(Class)
print all_button
test()
and the output is:
cr cs
[]
and if I modified the code in line 6 be
all_button = driver.find_element_by_class_name(Class)
I get error message:
Traceback (most recent call last):
File "c:/Users/LENOVO/OneDrive/Documents/project/python/Selenium/robot olshop.py", line 119, in <module>
test()
File "c:/Users/LENOVO/OneDrive/Documents/project/python/Selenium/robot olshop.py", line 114, in test
pesan = driver.find_element_by_class_name(element)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 564, in find_element_by_class_name
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 978, in find_element
'value': value})['value']
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: .cr cs
this is source of the website:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>ALdhy</title><meta name="referrer" content="origin-when-crossorigin" id="meta_referrer" /><style type="text/css">/*<![CDATA[*/.cz{background:#fff;}.db{background:#e9ebee;}.dj{position:relative;top:1px;}.b .dc{padding:0;}.b .w{padding:2px;}.b .dg{padding:4px;}.dz{color:#4b4f56;}.dv{color:#1d2129;}.du{font-size:14px;line-height:20px;}.dk{font-size:16px;line-height:20px;}.ba{font-weight:normal;}.da{font-weight:bold;}.b .df{border-collapse:collapse;margin:0;width:100%;}.b td.di{border:0;padding:6px 0 6px 6px;vertical-align:middle;}.b .df .dl{padding:6px 6px 6px 0;text-align:right;white-space:nowrap;}.b .dh{padding:6px;}.b .m{border:0;border-collapse:collapse;margin:0;padding:0;width:100%;}.b .m tbody{vertical-align:top;}.b .em>tr>td,.b .em>tbody>tr>td,.b .m td.em{vertical-align:middle;}.b .m td{padding:0;}.b .m td.w{padding:2px;}.b .m td.dg{padding:4px;}.b .t{width:100%;}.b .dp{padding:4px;}.dm>*,.dm.dm>*{border-bottom:1px solid #e5e5e5;}.dm>:last-child{border-bottom:none;}.dm+.dm{border-top:1px solid #e5e5e5;}.ec{float:right;max-width:85%;overflow:hidden;text-align:right;text-overflow:ellipsis;}.ea{-moz-user-select:none;}.dy{width:100%;}.dy .eb{text-align:right;}.bj .bl .ce{color:#42464d;font-size:19px;font-weight:bold;}.bj.b .bl .ce{margin-left:0;position:static;}.bj.b .bl .cg{margin-left:5px;vertical-align:baseline;}.bj .bl .ct{padding-left:4px;}.ed{position:relative;}.b .bs{height:100%;overflow:hidden;position:absolute;}.b .bm{background-color:#1c1e21;height:100px;position:relative;}.b .bt{height:auto;}.b .bu{width:inherit;}.b .br{width:100%;}.b .bw{margin-top:-45px;}.cv{word-wrap:break-word;}.ca{position:relative;}.cb{border:2px solid #fff;box-shadow:0 1px 2px rgba(0, 0, 0, .1);display:inline-block;}.b .cd{padding:5px 0 5px 0;text-align:center;}.b .bz{text-align:center;}.bx{background-color:#fff;}.i{background-color:#3b5998;}.cx{background-color:#d8dfea;border-top:solid 1px #3b5998;}.j{padding:2px 3px;}.ee{padding:4px 3px;}.by{padding:6px 3px;}.b a,.b a:visited{color:#3b5998;text-decoration:none;}.b .cu,.b .cu:visited{color:#6d84b4;}.b .bg,.b .bg:visited{color:#fff;}.b a:focus,.b a:hover,.b .cu:focus,.b .cu:hover{background-color:#3b5998;color:#fff;}.b .bg:focus,.b .bg:hover{background-color:#fff;color:#3b5998;}.ci{color:gray;}.ch{font-size:small;}body,tr,input,textarea,.f{font-size:medium;}.dt{padding-left:4px;}.cj .cl{display:inline-block;margin-right:4px;}.b .cj .cl{float:left;}.b .cj .cm{display:table-cell;}.s{border:0;display:inline-block;vertical-align:top;}i.s u{position:absolute;width:0;height:0;overflow:hidden;}.dw{margin-right:4px;}.co{clear:both;}.dr{border-radius:50%;}.cc{background:#eceff5;}.cf{margin:2px 0 0 5px;}.cq .cr{display:block;}.cr{border:solid 2px;cursor:pointer;margin:0;padding:2px 6px 3px;text-align:center;}.cs,.b a.cs{background:#f3f4f5;border-color:#ccc #aaa #999;color:#505c77;}.i .cs,.b .i a.cs{background:#3b5998;border-color:#8a9ac5 #29447E #1a356e;color:#fff;}.cr .s{pointer-events:none;}.cr{display:inline-block;}.cr+.cr{margin-left:3px;}.cr input{background:none;border:none;margin:0;padding:0;}.cs input{color:#505c77;}.i .cs input{color:#fff;}.bv{background:#f2f2f2;}.bp:hover .bv{background:none;}body{text-align:left;direction:ltr;}body,tr,input,textarea,button{font-family:sans-serif;}body,p,figure,h1,h2,h3,h4,h5,h6,ul,ol,li,dl,dd,dt{margin:0;padding:0;}h1,h2,h3,h4,h5,h6{font-size:1em;font-weight:bold;}ul,ol{list-style:none;}article,aside,figcaption,figure,footer,header,nav,section{display:block;}.e #viewport{margin:0 auto;max-width:600px;}#page{position:relative;}.r,.r.s{display:block;}.o{display:block;}.p{height:20px;width:20px;}.k{background:#3b5998;padding:0 4px 4px;height:22px;}.k.k .x{background:#fff;border:1px solid #243872;box-sizing:border-box;font-size:small;height:22px;margin:0;width:100%;}.l.k{padding:1px 1px 3px;}.k .q{padding:1px 3px 0 0;}.k.k.k .bc{background:#627aba;border:1px solid #2e417e;color:#fff;font-size:x-small;font-weight:normal;height:22px;line-height:20px;margin-left:3px;}form{margin:0;border:0;}.v{border:0;display:block;margin:0;padding:0;}.bb{-moz-appearance:none;background:none;display:inline-block;font-size:12px;height:28px;line-height:28px;margin:0;overflow:visible;padding:0 9px;text-align:center;vertical-align:top;white-space:nowrap;}.b .bb{border-radius:2px;}.bd,a.bd,html .b a.bd{color:#fff;}.b .bd{background-color:#4267b2;border:1px solid #365899;}.b a.bd:hover,.b .bd:hover{background-color:#465e91;}.bd[disabled]{color:#899bc1;}.b .bd[disabled]:hover{background-color:#4267b2;}.b a.bb::after{content:"";display:inline-block;height:100%;vertical-align:middle;}.b .bb{padding:0 8px;}.b a.bb{height:26px;line-height:26px;}.ef{font-size:small;padding:7px 8px 8px;}.ew{border:1px solid;border-color:#8d949e;border-radius:4px;display:block;margin-top:8px;padding:4px;text-align:center;}.eu{display:block;font-size:x-small;margin:-3px -3px 1px -3px;padding:3px;}.b .ef td.et{padding-right:4px;}.b .ef td.ev{padding-left:4px;}.ef.eg{background-color:#444950;}.eg{border-top:1px solid #444950;color:#bec3c9;}.b .eg a,.b .eg a:visited{color:#bec3c9;}.b .eg a:focus,.b .eg a:hover{background:#dadde1;color:#1d2129;}.ei{margin-bottom:8px;}.ef.eg .ei>table{background:#d3d7dc;border:1px solid #444950;}.ep{background:#d3d7dc;}.eh .es{height:24px;line-height:24px;margin-left:2px;}.ek{background:#fff;}.eh .eq{background-color:transparent;color:#4b4f56;display:block;padding:0;width:100%;}.el .s{display:block;}.eh .ej .er{padding:2px;}.eh .ej .el{padding:4px;}.b .eh .ej{border:1px solid #8d949e;}.be{padding-bottom:1px;}.bf{display:inline-block;font-size:small;padding:2px 4px 2px;}.bh{color:#fff496;}.b a:hover .bh,.b a:focus .bh,.bf:hover .bh,.bf:focus .bh{color:#365899;}/*]]>*/</style><link rel="manifest" href="/data/manifest/" crossorigin="use-credentials" /></head><body tabindex="0" class="b c d e"><div class="f"><div id="viewport"><div class="g h" id="MChromeHeader"><div class="i j" role="banner" id="header"><form method="get" action="/search/" class="k l"><input type="hidden" name="search" value="Search" /><input type="hidden" name="search_source" value="top_nav" /><table class="m" role="presentation"><tbody><tr><td class="n"><a class="o p q" href="/home.php?ref_component=mbasic_home_logo&ref_page=%2Fwap%2Fprofile_timeline.php%3Ainfo"><img src="https://static.xx.fbcdn.net/rsrc.php/v3/ym/r/Gjhrhb7r0lb.png" width="20" height="20" class="r s" alt="Facebook logo" /></a></td><td class="t u"><input class="v w x" name="query" placeholder="Cari Facebook" autocomplete="off" autocorrect="off" spellcheck="false" type="text" /></td><td class="n y"><input value="Cari" type="submit" class="z ba bb bc bd" /></td></tr></tbody></table></form><div role="navigation" class="be">BerandaProfil<a accesskey="4" href="/messages/?ref_component=mbasic_home_header&ref_page=%2Fwap%2Fprofile_timeline.php%3Ainfo" class="bf bg"><strong class="bh">Pesan<span aria-label="6 belum dibaca">(6)</span></strong></a><a accesskey="3" href="/notifications.php?ref_component=mbasic_home_header&ref_page=%2Fwap%2Fprofile_timeline.php%3Ainfo" class="bf bg"><strong class="bh">Notifikasi<span aria-label="4 baru">(4)</span></strong></a><a accesskey="6" href="/buddylist.php?ref_component=mbasic_home_header&ref_page=%2Fwap%2Fprofile_timeline.php%3Ainfo" class="bf bg">Obrolan<span aria-label="194 tersedia">(194)</span></a><a accesskey="2" href="/friends/center/mbasic/?fb_ref=tn&sr=1&ref_component=mbasic_home_header&ref_page=%2Fwap%2Fprofile_timeline.php%3Ainfo" class="bf bg">Teman<span aria-label="971 permintaan baru">(971)</span></a><strong class="bh">Halaman<span aria-label="8 pemberitahuan baru">(8)</span></strong><strong class="bh">Grup(39)</strong><div class="bf" style="display:block;height:0;overflow:hidden;position:absolute;width:0;padding:0"> </div><a accesskey="5" href="/menu/bookmarks/?ref_component=mbasic_home_header&ref_page=%2Fwap%2Fprofile_timeline.php%3Ainfo" class="bf bg">Menu</a></div></div></div><div id="objects_container"><div class="bi" id="root" role="main"><div class="bj bk"><div class="bl"><div><div class="bm bn"><div class="bo" id="profile_cover_photo_container"><img src="https://scontent.fcgk24-1.fna.fbcdn.net/v/t1.0-9/cp0/e15/q65/c0.423.480.160a/26815493_327420491088444_1281706991021315294_n.jpg?_nc_cat=105&efg=eyJpIjoiYiJ9&_nc_oc=AQkhUONjtbuCFItR6Lk3h_7hcd--7T1jMINkeYWyvzWLIST129G7yx5jfheQSmUWgHI&_nc_ht=scontent.fcgk24-1.fna&oh=429c5f77922a1e93371c495cf5f1c50c&oe=5E5580F2" width="320" height="160" class="bt bu bv s" /></div></div></div><div class="bw bx by"><div><div class="bz"><div class="ca cb"><img src="https://scontent.fcgk24-1.fna.fbcdn.net/v/t1.0-1/cp0/e15/q65/c12.0.74.74a/p74x74/75398266_697134660783690_3381090451179175936_o.jpg?_nc_cat=108&efg=eyJpIjoiYiJ9&_nc_oc=AQld6oI7W4qR3K81zygg6KwiL5nJZ6y9jfi6rXSIsxp7HS88TiAUeSdI74KcjIKilhw&_nc_ht=scontent.fcgk24-1.fna&oh=386b6fde17bfcd7fbaaf5308b54e7f89&oe=5E4AF13B" class="cc s" alt="ALdhy" /></div></div><span><div class="cd"><span><strong class="ce">ALdhy <span class="alternate_name">(Tompo)</span></strong><img src="https://static.xx.fbcdn.net/rsrc.php/v3/yK/r/Ye1TQi63ARL.png" width="8" height="12" class="cf cg s" aria-label="ALdhy dapat dihubungi melalui teleponnya" /></span></div><span class="ch ci"><span><div class="cj ck" role="heading" id="u_0_1"><img src="https://static.xx.fbcdn.net/rsrc.php/v3/yS/r/1HRQT0OcHKI.png" width="12" height="14" class="cl s" role="presentation" aria-level="4" /><span class="cm ch">Bekerja di <a class="cn" href="/profile.php?id=107980922563405">Swasta</a></span><div class="co"></div></div></span></span></span></div></div><div class="cp"><table class="cq"><tr><td>Tambah Jadi Teman</td><td>Pesan</td><td>Lainnya</td></tr></table></div><div class="ct f ci">Linimasa · Teman · Foto · Suka</div></div><div class="cv"><div class="cw bx"><h3 class="cx j">Teman</h3></div><div><div class="bx">Lihat Semua Teman (1040)</div></div></div><div class="cy"><div id="work"><div class="cz"><div class="da db dc dd de"><table class="df dg"><tr><td class="t dh di" aria-hidden="false"><div class="dj" role="heading" tabindex="0"><span class="dk">Pekerjaan</span></div></td><td class="t dl di"><div></div></td></tr></table></div><div class="dm dn"><div class="do dp" id="u_0_0"><div class="cj dq"><a class="cl" href="/profile.php?id=107980922563405"><img src="https://scontent.fcgk24-1.fna.fbcdn.net/v/t1.0-1/cp0/e15/q65/c14.0.48.48a/p48x48/399548_10149999285987789_1102888142_n.png.jpg?_nc_cat=1&efg=eyJpIjoiYiJ9&_nc_oc=AQl8gYxpUBwBm01VIUkCjywHWgrHloJpYkVJY8bXRaDXHJWwKfRiC-GVvrpLBOvO3tU&_nc_ht=scontent.fcgk24-1.fna&oh=d390e65f185dc2fae2c2bbec1e845648&oe=5E60DEE1" class="dr ds cc s" alt="Swasta" /></a><div class="dt cm"><div><span class="du dv da dw"><a class="cn" href="/profile.php?id=107980922563405">Swasta</a></span></div></div><div class="co"></div></div></div></div></div></div></div><div id="contact-info"><div class="cz"><div class="da db dc dd de"><table class="df dg"><tr><td class="t dh di" aria-hidden="false"><div class="dj" role="heading" tabindex="0"><span class="dk">Info Kontak</span></div></td><td class="t dl di"><div></div></td></tr></table></div><div class="dm dn"><div class="do dp dx" title="Facebook"><table cellspacing="0" cellpadding="0" class="dy"><tr><td valign="top"><div class="dz ea"><span class="dk dz ba">Facebook</span></div></td><td valign="top" class="eb"><div class="ec"> /aldhy.tompo</div></td></tr></table></div></div></div></div><div id="basic-info"><div class="cz"><div class="da db dc dd de"><table class="df dg"><tr><td class="t dh di" aria-hidden="false"><div class="dj" role="heading" tabindex="0"><span class="dk">Info Umum</span></div></td><td class="t dl di"><div></div></td></tr></table></div><div class="dm dn"><div class="do dp dx" title="Jenis Kelamin"><table cellspacing="0" cellpadding="0" class="dy"><tr><td valign="top"><div class="dz ea"><span class="dk dz ba">Jenis Kelamin</span></div></td><td valign="top" class="eb"><div class="ec">Laki-laki</div></td></tr></table></div></div></div></div><div id="nicknames"><div class="cz"><div class="da db dc dd de"><table class="df dg"><tr><td class="t dh di" aria-hidden="false"><div class="dj" role="heading" tabindex="0"><span class="dk">Nama Lain</span></div></td><td class="t dl di"><div></div></td></tr></table></div><div class="dm dn"><div class="do dp dx" title="Nama panggilan"><table cellspacing="0" cellpadding="0" class="dy"><tr><td valign="top"><div class="dz ea"><span class="dk dz ba">Nama panggilan</span></div></td><td valign="top" class="eb"><div class="ec">Tompo</div></td></tr></table></div></div></div></div><div id="relationship"><div class="cz"><div class="da db dc dd de"><table class="df dg"><tr><td class="t dh di" aria-hidden="false"><div class="dj" role="heading" tabindex="0"><span class="dk">Hubungan</span></div></td><td class="t dl di"><div></div></td></tr></table></div><div class="dm dn"><div class="ed dp"></div></div></div></div><div id="year-overviews"><div class="cz"><div class="da db dc dd de"><table class="df dg"><tr><td class="t dh di" aria-hidden="false"><div class="dj" role="heading" tabindex="0"><span class="dk">Peristiwa Penting</span></div></td><td class="t dl di"><div></div></td></tr></table></div><div class="dm dn"><div class="dp"><div></div><div></div><div></div><div></div><div></div></div></div></div></div><a name="footer-actions-basic"><div class="bx ee">Blokir orang ini<br />Cari Dukungan atau Laporkan Profil</div></a></div><div style="display:none"></div></div></div><div class="cz"><div class="ef eg"><div id="search_div"><form method="get" action="/search/"><input type="hidden" name="search" /><input type="hidden" name="search_source" value="footer" /><div class="eh ei"><table class="m ej ek" role="presentation"><tbody><tr><td class="n el em"><label for="u_0_3"><img src="https://static.xx.fbcdn.net/rsrc.php/v3/yC/r/hwCZEAcHQnm.png" width="20" height="20" class="en s" role="presentation" /></label></td><td class="t eo em"><input class="v dc ep eq" aria-label="Cari" name="query" id="u_0_3" type="text" /></td><td class="n er em"><input value="Cari" type="submit" class="z ba bb es bd" /></td></tr></tbody></table></div></form></div><table class="m" role="presentation"><tbody><tr><td class="t et" style="width:50%"><a class="eu" href="/pages/?ref=Footer&ref_component=mbasic_footer&ref_page=%2Fwap%2Fprofile_timeline.php%3Ainfo">Halaman Anda</a><a accesskey="0" class="eu" href="/help/?ref_component=mbasic_footer&ref_page=%2Fwap%2Fprofile_timeline.php%3Ainfo">Bantuan</a><a accesskey="7" class="eu" href="/settings/?entry_point=mbasic_footer_link&ref_component=mbasic_footer&ref_page=%2Fwap%2Fprofile_timeline.php%3Ainfo">Pengaturan & Privasi</a></td><td class="t ev" style="width:50%"><a class="eu" href="/bugnub/?source=Footer&ref_component=mbasic_footer&ref_page=%2Fwap%2Fprofile_timeline.php%3Ainfo">Laporkan Masalah</a><a accesskey="8" class="eu" href="/policies/?ref_component=mbasic_footer&ref_page=%2Fwap%2Fprofile_timeline.php%3Ainfo">Ketentuan & Kebijakan</a><a class="eu" href="/logout.php?h=AfdzPVB07vM3sCQL&t=1573644042&button_name=logout&button_location=footer&source=mbasic_logout_button&ref_component=mbasic_footer&ref_page=%2Fwap%2Fprofile_timeline.php%3Ainfo" id="mbasic_logout_button">Keluar (Fatonah)</a></td></tr></tbody></table><a class="ew" href="#header">Kembali ke Atas</a></div></div></div></div></body></html>
so, anyone can help me to fix this problem? how to find all elements in class 'cr cs'?
and how to fix the problem, if I just want to find an element in class 'cr cs'?
The call to button_lainnya.get_attribute('class') returns the class list for that element, which has two classes separated by a space character.
The call to get_element_by_class_name(Class) expects be to given a single class name --- "cr" or "cs", but not both.
If you need to find the element using both class names, then you need to use a CSS selector:
driver.find_element_by_css_selector(".cr.cs")
My python is a little rusty, but this should work:
selector = "." + Class.replace(" ", ".")
driver.find_element_by_css_selector(selector)
Why you are getting this error? Because your script doesn't find Lainnya in full page I also try and I get the same error when I see in the page there is not Lainnya text
SOLUTION:
Change The text you want for example ALdhy
or something because when I visit this page I see there is ALdhy and other name not Lainnya name so that's why u get this error
The error is showing up correctly, because it can't find Lainnya in your page

How to set dynamic page size (auto) in XSL-FO using Apache FOP?

I want to set the page size that should be dynamic according to the page contents.
That is, I want the page size of the PDF should be just as per the content size and not like A4, letter or something else.
My code is:
<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns="http://www.w3.org/1998/Math/MathML">
<fo:layout-master-set>
<fo:simple-page-master master-name="my-page">
<fo:region-body margin="1in"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="my-page">
<fo:flow flow-name="xsl-region-body" font="12pt Times">
<fo:block font-size="1.5em" font-weight="bold" role="html:p">
<fo:instream-foreign-object>
<math display="inline">
<mrow>
<mi>A</mi>
<mo>=</mo>
<mi>Ï€</mi>
<msup>
<mi>r</mi>
<mn>2</mn>
</msup>
</mrow>
</math>
</fo:instream-foreign-object>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
What I get is:
What I need is:
You could probably accomplish what you wish by changing the process slightly. JEuclid has an "foprep" function that would convert the MathML inside of XSL FO into the inline SVG for you. You could then apply an identity-translate on the resulting XSL FO to use the dimensions of the SVG as the dimensions of the page.
I did not do a complete test, but foprep on your sample would yield something like this (note I changed a few things like removing any margin on the original page and also set line-height on the block to "0" so that an exact size image fits.
This is what is the result of running "foprep" on your document.
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns="http://www.w3.org/1998/Math/MathML">
<fo:layout-master-set>
<fo:simple-page-master master-name="my-page">
<fo:region-body/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="my-page">
<fo:flow flow-name="xsl-region-body" font="12pt Times">
<fo:block line-height="0">
<fo:instream-foreign-object alignment-adjust="-9.090909%">
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" color-interpolation="auto"
color-rendering="auto" contentScriptType="text/ecmascript"
contentStyleType="text/css" fill="black" fill-opacity="1"
font-family="'Dialog'" font-size="12" font-style="normal"
font-weight="normal" height="11" image-rendering="auto"
preserveAspectRatio="xMidYMid meet" shape-rendering="auto" stroke="black"
stroke-dasharray="none" stroke-dashoffset="0" stroke-linecap="square"
stroke-linejoin="miter" stroke-miterlimit="10" stroke-opacity="1"
stroke-width="1" text-rendering="auto" version="1.0" width="39"
zoomAndPan="magnify">
<!--Converted from MathML using JEuclid-->
<defs id="genericDefs"/>
<g>
<g color-interpolation="linearRGB" color-rendering="optimizeQuality"
image-rendering="optimizeQuality"
text-rendering="optimizeLegibility" transform="translate(0.5469,10)">
<path
d="M3.9688 0 L4.0312 -0.2812 Q4.2969 -0.3125 4.4453 -0.4375 Q4.5938 -0.5625 4.6562 -0.7969 Q4.7188 -1.0312 4.7188 -1.4062 Q4.7188 -1.625 4.7031 -1.9062 L4.6719 -2.6562 L2.0938 -2.6562 L1.7656 -2.0781 Q1.5312 -1.6719 1.4297 -1.3828 Q1.3281 -1.0938 1.3281 -0.875 Q1.3281 -0.375 1.9219 -0.2812 L1.8594 0 L-0.5469 0 L-0.4844 -0.2812 Q-0.2969 -0.3125 -0.1328 -0.4297 Q0.0312 -0.5469 0.2109 -0.7891 Q0.3906 -1.0312 0.7188 -1.5938 L4.4688 -8.0938 L5.3594 -8.0938 L5.7812 -1.5625 Q5.8125 -1.0938 5.8828 -0.8359 Q5.9531 -0.5781 6.0859 -0.4531 Q6.2188 -0.3281 6.4688 -0.2812 L6.4062 0 L3.9688 0 ZM2.3438 -3.1719 L4.6406 -3.1719 L4.5469 -5.0469 Q4.5312 -5.4375 4.5156 -6.0156 Q4.5 -6.5938 4.5 -6.8594 L4.4375 -6.8594 L2.3438 -3.1719 Z"
stroke="none"/>
</g>
<g color-interpolation="linearRGB" color-rendering="optimizeQuality"
image-rendering="optimizeQuality"
text-rendering="optimizeLegibility" transform="translate(9.0775,10)">
<path
d="M0.7344 -4.2344 L0.7344 -5.0469 L5.9219 -5.0469 L5.9219 -4.2344 L0.7344 -4.2344 ZM0.7344 -1.8125 L0.7344 -2.625 L5.9219 -2.625 L5.9219 -1.8125 L0.7344 -1.8125 Z"
stroke="none"/>
</g>
<g color-interpolation="linearRGB" color-rendering="optimizeQuality"
image-rendering="optimizeQuality"
text-rendering="optimizeLegibility"
transform="translate(17.7957,10)">
<path
d="M2.5 -1.4688 Q2.5 -1.0781 2.5234 -0.8906 Q2.5469 -0.7031 2.6094 -0.6016 Q2.6719 -0.5 2.7891 -0.4297 Q2.9062 -0.3594 3.1875 -0.2812 L3.1875 0 L0.7031 0 L0.7031 -0.2812 Q1.0781 -0.375 1.1953 -0.4922 Q1.3125 -0.6094 1.3516 -0.8203 Q1.3906 -1.0312 1.3906 -1.4688 L1.3906 -6.5312 Q1.3906 -6.9375 1.3672 -7.125 Q1.3438 -7.3125 1.2734 -7.4141 Q1.2031 -7.5156 1.0938 -7.5781 Q0.9844 -7.6406 0.7031 -7.7188 L0.7031 -8 L3.1875 -8 L3.1875 -7.7188 Q2.9219 -7.6406 2.8125 -7.5781 Q2.7031 -7.5156 2.6328 -7.4219 Q2.5625 -7.3281 2.5312 -7.1328 Q2.5 -6.9375 2.5 -6.5312 L2.5 -1.4688 ZM3.5176 -9.9062 L3.5176 -8.875 L2.5332 -8.875 L2.5332 -9.9062 L3.5176 -9.9062 ZM1.3457 -9.9062 L1.3457 -8.875 L0.377 -8.875 L0.377 -9.9062 L1.3457 -9.9062 ZM6.7344 -3.0781 Q6.7812 -2.5 6.9141 -2.0156 Q7.0469 -1.5312 7.2812 -1.1797 Q7.5156 -0.8281 7.8438 -0.625 Q8.1719 -0.4219 8.625 -0.4219 Q9.1094 -0.4219 9.4141 -0.5234 Q9.7188 -0.625 9.9219 -0.8516 Q10.125 -1.0781 10.3125 -1.5312 L10.8906 -1.5312 L10.8906 -0.2031 Q10.3594 -0.0625 9.7891 0.0156 Q9.2188 0.0938 8.5312 0.0938 Q7.2188 0.0938 6.4844 -0.7109 Q5.75 -1.5156 5.5938 -3.0781 L4.2031 -3.0781 L4.2031 -3.6406 L5.5625 -3.6406 L5.5625 -3.9375 Q5.5625 -4.2969 5.5938 -4.6719 L4.625 -4.6719 L4.625 -5.2344 L5.6875 -5.2344 Q5.9688 -6.6094 6.8125 -7.3516 Q7.6562 -8.0938 8.9062 -8.0938 Q9.4375 -8.0938 9.8828 -8.0391 Q10.3281 -7.9844 10.8906 -7.8281 L10.8906 -6.5 L10.3125 -6.5 Q10.1719 -6.9062 9.9531 -7.1406 Q9.7344 -7.375 9.4531 -7.4766 Q9.1719 -7.5781 8.7656 -7.5781 Q8.2812 -7.5781 7.8672 -7.3047 Q7.4531 -7.0312 7.1719 -6.5078 Q6.8906 -5.9844 6.7812 -5.2344 L10.3281 -5.2344 L10.3281 -4.6719 L6.7344 -4.6719 Q6.7031 -4.4062 6.7031 -4.0156 L6.7031 -3.8438 Q6.7031 -3.7344 6.7031 -3.6406 L9.9219 -3.6406 L9.9219 -3.0781 L6.7344 -3.0781 Z"
stroke="none"/>
</g>
<g color-interpolation="linearRGB" color-rendering="optimizeQuality"
image-rendering="optimizeQuality"
text-rendering="optimizeLegibility"
transform="translate(28.6863,10)">
<path
d="M2.3281 -5.6562 L2.6875 -5.6562 L2.2812 -4.2188 L2.3438 -4.1875 Q2.9062 -4.9531 3.4375 -5.3281 Q3.9688 -5.7031 4.5312 -5.7031 Q4.9531 -5.7031 5.2344 -5.625 L4.9531 -4.3125 L4.3594 -4.3125 Q4.3125 -4.625 4.2109 -4.7812 Q4.1094 -4.9375 3.8906 -4.9375 Q3.6719 -4.9375 3.375 -4.7031 Q3.0781 -4.4688 2.7656 -4.0625 Q2.4531 -3.6562 2.2969 -3.3047 Q2.1406 -2.9531 2.0625 -2.5312 L1.5312 0 L0.5156 0 L1.4062 -4 Q1.5312 -4.5469 1.5312 -4.8438 Q1.5312 -5 1.4766 -5.0938 Q1.4219 -5.1875 1.3047 -5.2344 Q1.1875 -5.2812 0.9062 -5.2969 L0.9688 -5.6094 L2.3281 -5.6562 Z"
stroke="none"/>
</g>
<g color-interpolation="linearRGB" color-rendering="optimizeQuality"
image-rendering="optimizeQuality"
text-rendering="optimizeLegibility"
transform="translate(33.9207,7.3281)">
<path
d="M3.0781 -0.7031 Q3.2969 -0.7031 3.4297 -0.7266 Q3.5625 -0.75 3.6406 -0.8125 Q3.7188 -0.875 3.7656 -0.9766 Q3.8125 -1.0781 3.8906 -1.2812 L4.2656 -1.2812 L4.1875 0 L0.5625 0 L0.5625 -0.2188 Q0.75 -0.6719 1.0703 -1.1562 Q1.3906 -1.6406 1.9844 -2.2969 Q2.5 -2.8594 2.7188 -3.1406 Q2.9688 -3.4688 3.0859 -3.6953 Q3.2031 -3.9219 3.2578 -4.125 Q3.3125 -4.3281 3.3125 -4.5469 Q3.3125 -4.875 3.2109 -5.125 Q3.1094 -5.375 2.8906 -5.5234 Q2.6719 -5.6719 2.3438 -5.6719 Q1.5156 -5.6719 1.2344 -4.75 L0.7031 -4.75 L0.7031 -5.5938 Q1.2344 -5.8438 1.6953 -5.9531 Q2.1562 -6.0625 2.5312 -6.0625 Q3.3438 -6.0625 3.7578 -5.7109 Q4.1719 -5.3594 4.1719 -4.6719 Q4.1719 -4.4375 4.1328 -4.2422 Q4.0938 -4.0469 3.9922 -3.8594 Q3.8906 -3.6719 3.7266 -3.4453 Q3.5625 -3.2188 3.3594 -2.9922 Q3.1562 -2.7656 2.6562 -2.25 Q1.8125 -1.3594 1.4219 -0.7031 L3.0781 -0.7031 Z"
stroke="none"/>
</g>
</g>
</svg>
</fo:instream-foreign-object>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
Now, if I apply an XSL to that which just copies everything and grabs the width and height of the SVG to use as the page-width and page-height.
This XSL would copy dimensions for the SVG and use them as page-width, page-height in the FO:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:fo="http://www.w3.org/1999/XSL/Format" exclude-result-prefixes="svg" version="1.0">
<xsl:template match="fo:simple-page-master">
<fo:simple-page-master>
<xsl:apply-templates select="#*"/>
<xsl:attribute name="page-width">
<xsl:value-of select="concat(//*[namespace-uri()='http://www.w3.org/2000/svg' and local-name()='svg'][1]/#width,'px')"/>
</xsl:attribute>
<xsl:attribute name="page-height">
<xsl:value-of select="concat(//*[namespace-uri()='http://www.w3.org/2000/svg' and local-name()='svg'][1]/#height,'px')"/>
</xsl:attribute>
<xsl:apply-templates select="node()"/>
</fo:simple-page-master>
</xsl:template>
<xsl:template match="node()|#*">
<xsl:copy>
<xsl:apply-templates select="node()|#*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
I would get this output in the page template (abbreviated only showing the page-master):
<fo:simple-page-master master-name="my-page" page-width="39px" page-height="11px">
<fo:region-body/>
</fo:simple-page-master>
As you can see, the page-width and page-height is set to the dimensions of the SVG.
This process chain would allow you to the format that to a page that is the size of the SVG (as calculated by JEuclid).
The result is this:

Filtering using xslt for specific node values

I need to filter huge and redundant xml file.
Easy thing is to eliminate all nodes with no attributes and no content:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="#*|node()">
<xsl:if test=". != '' or ./#* != ''">
<xsl:copy>
<xsl:apply-templates select="#*|node()"/>
</xsl:copy>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
but i also need to filter out nodes containing
<type>0</type>
nodes containing only
<whatever id="-1 />
and nodes containing only empty attributes like:
<dateacquired year="" month="" day="" long="" unformatted=""/>
an excerpt of my (machine generated) input file is:
<record table="book" id="1">
<bookdata>
<bookid unformatted="1">1</bookid>
<marked bool="False">No</marked>
<lastmodified year="2013" month="09" day="25" long="Wednesday, September 25, 2013" unformatted="20130925">09/25/2013</lastmodified>
<title>Intervista Col Vampiro</title>
<fulltitle>Ciclo Dei Vampiri: Intervista Col Vampiro</fulltitle>
<fulltitle2>Intervista Col Vampiro (Ciclo Dei Vampiri)</fulltitle2>
<referenceno>BB00001</referenceno>
<publishdate year="1993" month="" day="" long="1993" unformatted="1993">1993</publish date>
<copyrightdate year="" month="" day="" long="" unformatted=""/>
<type id="-1"/>
<authors sort="Rice, Anne">
<author id="1">
<name>Anne Rice</name>
<sortby>Rice, Anne</sortby>
<roles/>
</author>
</authors>
<credits/>
<image1>
<filename>Book_1_3.jpg</filename>
<type>2</type>
<notes/>
</image1>
<image2>
<filename/>
<type>0</type>
<notes/>
</image2>
<image3>
<filename/>
<type>0</type>
<notes/>
</image3>
<image4>
<filename/>
<type>0</type>
<notes/>
</image4>
<image5>
<filename/>
<type>0</type>
<notes/>
</image5>
<image6>
<filename/>
<type>0</type>
<notes/>
</image6>
<image7>
<filename/>
<type>0</type>
<notes/>
</image7>
<image8>
<filename/>
<type>0</type>
<notes/>
</image8>
<image9>
<filename/>
<type>0</type>
<notes/>
</image9>
<subtitle/>
<titlesort>Intervista Col Vampiro</titlesort>
<publisher id="1">Salani</publisher>
<publicationplace id="-1"/>
<isbn/>
<lccn/>
<lccallnum/>
<dewey>823.9</dewey>
<country id="-1"/>
<pages unformatted="283">283</pages>
<numberofsections unformatted="0">0</numberofsections>
<printedby id="-1"/>
<binding id="-1"/>
<edition id="1">Ebook</edition>
<printing id="-1"/>
<language id="-1"/>
<series id="1">Ciclo Dei Vampiri</series>
<releaseno unformatted="0">0</releaseno>
<originaltitle>Interview With The Vampire</originaltitle>
<originalsubtitle/>
<originalpublisher id="-1"/>
<originalcountry id="-1"/>
<originallanguage id="-1"/>
<originalcopyright year="1976" month="" day="" long="1976" unformatted="1976">1976</originalcopyright>
<price integer="8" fraction="0" unformatted="8.0">8.00</price>
<value integer="0" fraction="0" unformatted="0.0">0.00</value>
<sellingprice integer="0" fraction="0" unformatted="0.0">0.00</sellingprice>
<changeinvalue>0.00</changeinvalue>
<changeinvaluepr>0.00</changeinvaluepr>
<condition id="-1"/>
<appraiser id="-1"/>
<insurance id="-1"/>
<registered year="2005" month="09" day="10" long="Saturday, September 10, 2005" unformatted="20050910">09/10/2005</registered>
<status id="-1"/>
<dateacquired year="" month="" day="" long="" unformatted=""/>
<acquiredfrom id="-1"/>
<personalrating id="-1"/>
<category id="1">Horror-Gotico</category>
<subcategory id="-1"/>
<owner id="-1"/>
<location id="-1"/>
<keywords>
<keyword id="1">Vampiro</keyword>
<keyword id="2">Vampiri</keyword>
</keywords>
<newbook bool="False">No</newbook>
<onloan bool="False">No</onloan>
<overdue bool="False">No</overdue>
<borrower id="-1"/>
<borrowercategory id="-1"/>
<dateborrowed year="" month="" day="" long="" unformatted=""/>
<datedue year="" month="" day="" long="" unformatted=""/>
<reserved bool="False">No</reserved>
<reservedto id="-1"/>
<reserveddate year="" month="" day="" long="" unformatted=""/>
<awards/>
<awardyear/>
<awarddetails/>
<nominations/>
<nominationyear/>
<nominationdetails/>
<custom01/>
<custom02/>
<custom03>http://www.ddunlimited.net/viewtopic.php?f=1079&t=3749847</custom03>
<custom04/>
<custom05 id="-1"/>
<custom06 id="-1"/>
<custom07 id="-1"/>
<custom08 id="-1"/>
<custom09 year="" month="" day="" long="" unformatted=""/>
<custom10 integer="0" fraction="0" unformatted="0.0">0.00</custom10>
<custom11 bool="True">Yes</custom11>
<custom12 bool="False">No</custom12>
<custom13 bool="False">No</custom13>
<custom14 bool="True">Yes</custom14>
<custom15 bool="False">No</custom15>
<custom16 bool="False">No</custom16>
<custom17 bool="False">No</custom17>
<custom18 bool="False">No</custom18>
<notes>ed2k://|file|eBook.ITA.001.Anne.Rice.Intervista.Col.Vampiro.(doc.lit.pdf.rtf).[Hyps].rar|1998285|81D4C283C03E5787170A33C335577533|/</notes>
<synopsis>A San Francisco alle soglie del 2000 il giornalista Mallory viene avvicinato da Louis De Point Du Lac, vampiro dal 1791, quando era un proprietario terriero presso New Orleans. Ridotto alla disperazione per la perdita della moglie e della figlioletta vieneiniziato alla sua tenebrosa e ferina esistenza da Lestat, collega di origini parigine, che cerca invano di far superare al discepolo l&apos;innata repulsione per l&apos;omicidio. Invano Louis si ciba di sangue di ratti e galline, e fà fuggire i servi incendiando la casa. Ormai Lestat lo domina e lo coinvolge in efferate uccisioni di innocenti. Una bimba orfana, Claudia, viene "adottata" dai due e si rivela feroce quant&apos;altri mai.</synopsis>
<reviews/>
<weblinks/>
<weblinktype id="1"/>
<filelinks/>
<filelinktype id="1"/>
<barcode/>
<originalseries id="-1"/>
<originalreleaseno unformatted="0">0</originalreleaseno>
<readhistory/>
<lastread year="" month="" day="" long="" unformatted=""/>
<readcount unformatted="0">0</readcount>
<dustjacketcondition id="-1"/>
<dimensions_width integer="0" fraction="0" unformatted="0.0">0.00</dimensions_width>
<dimensions_height integer="0" fraction="0" unformatted="0.0">0.00</dimensions_height>
<dimensions_depth integer="0" fraction="0" unformatted="0.0">0.00</dimensions_depth>
<coverprice integer="0" fraction="0" unformatted="0.0">0.00</coverprice>
<coverprice_currency id="-1"/>
<booklinks/>
</bookdata>
<contentsdata items="0"/>
</record>
desired output would be:
<record table="book" id="1">
<bookdata>
<bookid unformatted="1">1</bookid>
<marked bool="False">No</marked>
<lastmodified year="2013" month="09" day="25" long="Wednesday, September 25, 2013" unformatted="20130925">09/25/2013</lastmodified>
<title>Intervista Col Vampiro</title>
<fulltitle>Ciclo Dei Vampiri: Intervista Col Vampiro</fulltitle>
<fulltitle2>Intervista Col Vampiro (Ciclo Dei Vampiri)</fulltitle2>
<referenceno>BB00001</referenceno>
<publishdate year="1993" month="" day="" long="1993" unformatted="1993">1993</publish date>
<authors sort="Rice, Anne">
<author id="1">
<name>Anne Rice</name>
<sortby>Rice, Anne</sortby>
</author>
</authors>
<image1>
<filename>Book_1_3.jpg</filename>
<type>2</type>
</image1>
<titlesort>Intervista Col Vampiro</titlesort>
<publisher id="1">Salani</publisher>
<dewey>823.9</dewey>
<pages unformatted="283">283</pages>
<numberofsections unformatted="0">0</numberofsections>
<edition id="1">Ebook</edition>
<series id="1">Ciclo Dei Vampiri</series>
<releaseno unformatted="0">0</releaseno>
<originaltitle>Interview With The Vampire</originaltitle>
<originalcopyright year="1976" month="" day="" long="1976" unformatted="1976">1976</originalcopyright>
<price integer="8" fraction="0" unformatted="8.0">8.00</price>
<value integer="0" fraction="0" unformatted="0.0">0.00</value>
<sellingprice integer="0" fraction="0" unformatted="0.0">0.00</sellingprice>
<changeinvalue>0.00</changeinvalue>
<changeinvaluepr>0.00</changeinvaluepr>
<registered year="2005" month="09" day="10" long="Saturday, September 10, 2005" unformatted="20050910">09/10/2005</registered>
<category id="1">Horror-Gotico</category>
<keywords>
<keyword id="1">Vampiro</keyword>
<keyword id="2">Vampiri</keyword>
</keywords>
<newbook bool="False">No</newbook>
<onloan bool="False">No</onloan>
<overdue bool="False">No</overdue>
<reserved bool="False">No</reserved>
<custom03>http://www.ddunlimited.net/viewtopic.php?f=1079&t=3749847</custom03>
<custom10 integer="0" fraction="0" unformatted="0.0">0.00</custom10>
<custom11 bool="True">Yes</custom11>
<custom12 bool="False">No</custom12>
<custom13 bool="False">No</custom13>
<custom14 bool="True">Yes</custom14>
<custom15 bool="False">No</custom15>
<custom16 bool="False">No</custom16>
<custom17 bool="False">No</custom17>
<custom18 bool="False">No</custom18>
<notes>ed2k://|file|eBook.ITA.001.Anne.Rice.Intervista.Col.Vampiro.(doc.lit.pdf.rtf).[Hyps].rar|1998285|81D4C283C03E5787170A33C335577533|/</notes>
<synopsis>A San Francisco alle soglie del 2000 il giornalista Mallory viene avvicinato da Louis De Point Du Lac, vampiro dal 1791, quando era un proprietario terriero presso New Orleans. Ridotto alla disperazione per la perdita della moglie e della figlioletta vieneiniziato alla sua tenebrosa e ferina esistenza da Lestat, collega di origini parigine, che cerca invano di far superare al discepolo l&apos;innata repulsione per l&apos;omicidio. Invano Louis si ciba di sangue di ratti e galline, e fà fuggire i servi incendiando la casa. Ormai Lestat lo domina e lo coinvolge in efferate uccisioni di innocenti. Una bimba orfana, Claudia, viene "adottata" dai due e si rivela feroce quant&apos;altri mai.</synopsis>
<weblinktype id="1"/>
<filelinktype id="1"/>
<originalreleaseno unformatted="0">0</originalreleaseno>
<readcount unformatted="0">0</readcount>
<dimensions_width integer="0" fraction="0" unformatted="0.0">0.00</dimensions_width>
<dimensions_height integer="0" fraction="0" unformatted="0.0">0.00</dimensions_height>
<dimensions_depth integer="0" fraction="0" unformatted="0.0">0.00</dimensions_depth>
<coverprice integer="0" fraction="0" unformatted="0.0">0.00</coverprice>
</bookdata>
<contentsdata items="0"/>
</record>
Problem is I do not really grok transformations and, while I tried to read about them, I didn't find a comprehensible tutorial. Any pointer welcome!
As an additional bonus I would also like to filter out specific "null" items like the above dimensions_*.
TiA
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="#*|node()">
<xsl:copy>
<xsl:apply-templates select="#*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="*[normalize-space(.) = 0]" />
<xsl:template match="*[normalize-space(.) = '' and count(#*[. = '']) = count(#*)]" />
<!-- write more empty templates for nodes that should be removed -->
</xsl:stylesheet>
Note that count(#*[. = '']) = count(#*) could be written as not(#*[. != '']) if you fancy that.