Dear developers,
i am writing an application using C++ and Qt5 where I need to parse xml
files with the embedded stylesheets. I have found great tutorial for
Xalan-j ( http://xml.apache.org/xalan-j/usagepatterns.html#embed) but I
am finding hard time to find corresponding functionality in C++ library.
For the time being I will be using xsltproc via system() procedure.
Could someone please point me the right direction. Please find the
sample xml file attached.
Kind Regards,
Pavel
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="#stylesheet"?>
<!DOCTYPE uddf [
<!ATTLIST xsl:stylesheet
id ID #REQUIRED>
]>
<data>
<xsl:stylesheet id="stylesheet"
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:template match="xsl:stylesheet"/>
<xsl:template match="pressure">
<depth><xsl:value-of select="(. - 1013) * 0.01"/></depth>
</xsl:template>
<!-- identity template -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
<dive>
<samples>
<waypoint>
<divetime>0</divetime>
<pressure>1013</pressure>
</waypoint>
<waypoint>
<divetime>10</divetime>
<pressure>1513</pressure>
</waypoint>
<waypoint>
<divetime>20</divetime>
<pressure>2013</pressure>
</waypoint>
<waypoint>
<divetime>30</divetime>
<pressure>1013</pressure>
</waypoint>
</samples>
</dive>
</data>