Я хочу преобразовать это XML:
<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<advisory>
<employee_assigned>
<name>
Ethel Pinili
</name>
<employee_id>
123221
</employee_id>
<group>
BCMS
</group>
</employee_assigned>
<advised_date>
<month>April</month>
<day>13</day>
<year>2020</year>
</advised_date>
<event_notification>
<incident_date>
<month>April</month>
<day>13</day>
<year>2020</year>
</incident_date>
<incident_cause>Theft</incident_cause>
<incident_nature>Business Interruption</incident_nature>
<site_affected>
<site_name>BGC Office</site_name>
<site_id>BGC221</site_id>
<site_description>Corporate Office</site_description>
<site_address>Taguig City, Metro Manila</site_address>
<site_manager>
<name>
Joel Hagibis
</name>
<contact>
09192267786
</contact>
</site_manager>
<site_down_time>2 days</site_down_time>
<affected_subs>128000</affected_subs>
<damaged>
<item>
<name>Building Power Supply</name>
<qty>1</qty>
<price>25000</price>
</item>
<item>
<name>Wirings</name>
<qty>100</qty>
<price>10000</price>
</item>
</damaged>
</site_affected>
<incident_description>
BGC Office is temporarily closed because of electrical malfunctioning. First degree alarm of fire was raised.
</incident_description>
<support_documents>Photographs, Security Invistigation Report</support_documents>
<third_parties>Meralco & MA Electrical Insurance</third_parties>
<restoration_strategy>Electrical system restoration</restoration_strategy>
</event_notification>
</advisory>
В это:
<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<INR>
<prepared_by id_no="123221">
<name>
Ethel Pinili
</name>
<group>
BCMS
</group>
</prepared_by>
<inr_filing_date>
<month>April</month>
<day>13</day>
<year>2020</year>
</inr_filing_date>
<incident>
<inc_date>
<month>April</month>
<day>13</day>
<year>2020</year>
</inc_date>
<cause>Theft</cause>
<nature>Business Interruption</nature>
<site>
<name>BGC Office</name>
<pla_id>BGC221</pla_id>
<description>Corporate Office</description>
<place_of_incident>Taguig City, Metro Manila</place_of_incident>
<manager contact="09192267786">Joel Hagibis</manager>
<down_time>2 days</down_time>
<affected_subs>128000</affected_subs>
<damaged>
<item>
<name>Building Power Supply</name>
<qty>1</qty>
<price>25000</price>
</item>
<item>
<name>Wirings</name>
<qty>100</qty>
<price>10000</price>
</item>
</damaged>
</site>
<incident_description>
BGC Office is temporarily closed because of electrical malfunctioning.
</incident_description>
<support_doc>Photographs, Security Invistigation Report</support_doc>
<third_parties>Meralco & MA Electrical Insurance</third_parties>
<restoration_strategy>Electrical system restoration</restoration_strategy>
</incident>
</INR>
Требуется использовать таблицу стилей XSL. Все мои попытки имеют ошибку, которая говорит:
"Имя сущности должно сразу следовать за '&' в ссылке на сущность.
com.sun.org. apache. xml .internal.utils.WrappedRuntimeException: имя объекта должно следовать сразу за '&' в ссылке на объект. ".
Вот моя попытка:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml"/>
<xsl:template match="/">
<inr>
<prepared_by>
<name>
<xsl:value-of select="employee_assigned/name/text()"/>
</name>
<group>
<xsl:value-of select="employee_assigned/group/text()"/>
</group>
</prepared_by>
<inr_filing_date>
<month>
<xsl:value-of select="../advised_date/month/text()"/>
</month>
<day>
<xsl:value-of select="../advised_date/day/text()"/>
</day>
<year>
<xsl:value-of select="../advised_date/day/text()"/>
</year>
</inr_filing_date>
</inr>
</xsl:template>
</xsl:stylesheet>