Ben de sistemde çalışanların bir XML belgesi vardır:Satır sonları ( n) XPath içinde concat() aracılığıyla?
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<couriersystem title="System"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="schema.xsd">
<!-- snip -->
<employees>
<employee eid="1">
<nin>AZ123518D</nin>
<firstname>Peter</firstname>
<lastname>Smith</lastname>
<gender>Male</gender>
<dob>1994-02-11</dob>
<email>[email protected]</email>
<address>
119, London Street, Nidrie, F57 8NE
</address>
<tel>07005748900</tel>
<salary>30526</salary>
<empbranch bid="1" />
<supervisor sid="1" />
</employee>
<employee eid="2">
<nin>CN174869F</nin>
<firstname>Jennifer</firstname>
<lastname>Black</lastname>
<gender>Male</gender>
<dob>1984-12-24</dob>
<email>[email protected]</email>
<address>
161, South Road, Nidrie, W79 8WG
</address>
<tel>07555111222</tel>
<salary>40576</salary>
<empbranch bid="2" />
<supervisor sid="1" />
</employee>
<employee eid="3">
<nin>ET127654M</nin>
<firstname>Aaron</firstname>
<lastname>Jones</lastname>
<gender>Male</gender>
<dob>1968-03-15</dob>
<email>[email protected]</email>
<address>
66, High Road, Yoker, Q47 4SR
</address>
<tel>07856471267</tel>
<salary>30526</salary>
<empbranch bid="3" />
<supervisor sid="1" />
</employee>
<employee eid="4">
<nin>GC765238A</nin>
<firstname>Alistair</firstname>
<lastname>Smith</lastname>
<gender>Male</gender>
<dob>1976-11-26</dob>
<email>[email protected]</email>
<address>
109, West Plaza, Clydebank, G55 8RC
</address>
<tel>0700</tel>
<salary>25400</salary>
<empbranch bid="4" />
<supervisor sid="1" />
</employee>
<employee eid="5">
<nin>HP146854D</nin>
<firstname>Emma</firstname>
<lastname>Reynolds</lastname>
<gender>Male</gender>
<dob>1995-05-05</dob>
<email>[email protected]</email>
<address>
57, Scott Street, Aberdeen, O75 2KS
</address>
<tel>07625361536</tel>
<salary>25400</salary>
<empbranch bid="5" />
<supervisor sid="7" />
</employee>
<!-- snip -->
</employees>
<!-- snip -->
</couriersystem>
Ve ben onların amiri tarafından çalışan tüm ayrıntıları almak için XPath vardır:
//employee[supervisor/@sid='1']/concat('Name: ', concat(firstname/text(), ' ', lastname/text(), '\nGender: ', gender/text(), '\nD.O.B: ', dob/text()))
Ama sadece gösterileri Bunların geri kalanından bir çalışan ve \n
karakter de gösterir.
Bu sorunu nasıl düzeltebilirim? @madcrazydrumma]:
Sadece geri dönen bir sonuç olsa da, bu en garip şey! – madcrazydrumma
Hangi XPath 2.0 kütüphanesini kullanıyorsunuz? – kjhughes
Bunu test etmek için kullanıyorum: http://www.xpathtester.com/xpath – madcrazydrumma