ho un foglio di stile che dovrebbe estrarre dei valori da un file XML di origine e riscriverli in un nuovo schema XML.
Il problema è che lo schema viene scritto ma non vengono riportati i valori che intendo visualizzare.
XML in input
foglio di stile XSLcodice:<?xml version='1.0' encoding='ISO-8859-1' ?> <?xml-stylesheet type="text/xsl" href="t_contourshape.xsl"?> <Mpeg7><DescriptionUnit><Descriptor><Region><RegionNumber>255</RegionNumber> <GlobalCurvature>7 3 </GlobalCurvature> <PrototypeCurvature>1 3 </PrototypeCurvature> <HighestPeakY>15</HighestPeakY> <Peak peakX = "58" peakY = "5"/> <Peak peakX = "5" peakY = "7"/> <Peak peakX = "59" peakY = "1"/> <Peak peakX = "61" peakY = "6"/> <Peak peakX = "4" peakY = "6"/> <Peak peakX = "2" peakY = "6"/> <Peak peakX = "1" peakY = "7"/> </Region> </Descriptor> </DescriptionUnit> </Mpeg7>
XML in output. da notare i tag praticamente vuoticodice:<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" encoding="utf-8"/> <xsl:param name="instance" select="anonymous"/> <xsl:template match="/" xmlns:tst="urn:mpeg:mpeg7:schema:2001" xml:base="http://www.acemedia.org/fact-statements/PROTOTYPES#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema" xmlns:vdo="http://www.acemedia.org/ontologies/VDO#" xmlns:vdoext="http://www.acemedia.org/ontologies/VDO-EXT#"> <vdo:ContourShapeDescriptor rdf:about="{$instance}"> <xsl:variable name="gcevar" select="tst:Mpeg7/tst:DescriptionUnit/tst:Descriptor/tst:Region/tst:GlobalCurvature"/> <xsl:variable name="gcevar1" select="substring-before($gcevar,' ')"/> <vdo:globalCurvatureCircularity> <xsl:value-of select="$gcevar1"/> </vdo:globalCurvatureCircularity> <xsl:variable name="gcevar2" select="substring-before(substring-after($gcevar,' '),' ')"/> <vdo:globalCurvatureEccentricity> <xsl:value-of select="$gcevar2"/> </vdo:globalCurvatureEccentricity> <xsl:variable name="pccvar" select="tst:Mpeg7/tst:DescriptionUnit/tst:Descriptor/tst:Region/tst:PrototypeCurvature"/> <xsl:variable name="pccvar1" select="substring-before($pccvar,' ')"/> <vdo:prototypeCurvatureCircularity> <xsl:value-of select="$pccvar1"/> </vdo:prototypeCurvatureCircularity> <xsl:variable name="pccvar2" select="substring-before(substring-after($pccvar,' '),' ')"/> <vdo:prototypeCurvatureEccentricity> <xsl:value-of select="$pccvar2"/> </vdo:prototypeCurvatureEccentricity> <vdo:highestPeakY> <xsl:value-of select="tst:Mpeg7/tst:DescriptionUnit/tst:Descriptor/tst:Region/tst:HighestPeakY"/> </vdo:highestPeakY> <xsl:for-each select="tst:Mpeg7/tst:DescriptionUnit/tst:Descriptor/tst:Region/tst:Peak"> <vdo:peakX> <xsl:value-of select="./@peakX"/> </vdo:peakX> </xsl:for-each> <xsl:for-each select="tst:Mpeg7/tst:DescriptionUnit/tst:Descriptor/tst:Region/tst:Peak"> <vdo:peakY> <xsl:value-of select="./@peakY"/> </vdo:peakY> </xsl:for-each> <vdo:numberOfPeaks> <xsl:value-of select="count(tst:Mpeg7/tst:DescriptionUnit/tst:Descriptor/tst:Region/tst:Peak)"/> </vdo:numberOfPeaks> </vdo:ContourShapeDescriptor> </xsl:template> </xsl:stylesheet>
codice:<?xml version="1.0" encoding="utf-8"?> <vdo:ContourShapeDescriptor xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema" xmlns:tst="urn:mpeg:mpeg7:schema:2001" xmlns:vdo="http://www.acemedia.org/ontologies/VDO#" xmlns:vdoext="http://www.acemedia.org/ontologies/VDO-EXT#" rdf:about=""> <vdo:globalCurvatureCircularity></vdo:globalCurvatureCircularity> <vdo:globalCurvatureEccentricity></vdo:globalCurvatureEccentricity> <vdo:prototypeCurvatureCircularity></vdo:prototypeCurvatureCircularity> <vdo:prototypeCurvatureEccentricity></vdo:prototypeCurvatureEccentricity> <vdo:highestPeakY></vdo:highestPeakY> <vdo:numberOfPeaks>0</vdo:numberOfPeaks> </vdo:ContourShapeDescriptor>

Rispondi quotando