我正在尝试遍历 SVG 目录以访问其中的一些元数据。但是,当我尝试在每个节点中获取特定节点的值时,我可以很好地迭代,我似乎失败了。
使用 SaxonHE 9.4 (Java) 进行转换。
这里的例子看起来很简单:
<xsl:value-of select="document('geneva.xml')/ph:photo/ph:title"/>
http://www.ibm.com/developerworks/xml/library/x-tipcombxslt/
然而我有我的 XSLT(相关部分;没有迭代 atm 只是一个获取外部节点值的测试):
<div>
<p><xsl:value-of select="document('images/test.svg')"/></p>
</div>
但这一切给我的是:
<div><p>Mine
circle:hover {fill-opacity:0.9;}
</p></div>
我试过document('images/test.svg')/svg/title
了,但这没有给我任何回报
测试.svg
<?xml version="1.0"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg xmlns="http://www.w3.org/2000/svg">
<title>Mine</title>
<style type="text/css">
circle:hover {fill-opacity:0.9;}
</style>
<g style="fill-opacity:0.7;">
<circle cx="6.5cm" cy="2cm" r="100" style="fill:red; stroke:black; stroke-width:0.1cm" transform="translate(0,50)" />
<circle cx="6.5cm" cy="2cm" r="100" style="fill:blue; stroke:black; stroke-width:0.1cm" transform="translate(70,150)" />
<circle cx="6.5cm" cy="2cm" r="100" style="fill:green; stroke:black; stroke-width:0.1cm" transform="translate(-70,150)"/>
</g>
</svg>