SAS proc XSL错误

时间:2015-07-09 18:18:10

标签: xml xslt sas

我有一个XML文件,我想使用填充的xsl表进行转换。 SAS有一个Proc XSL应该可以执行此任务,但我得到以下错误

  

错误:javax.xml.transform.TransformerConfigurationException:无法编译样式表。 6          检测到错误。   错误:java.io.IOException:管道已关闭

还有其他人遇到过这样的错误吗?是与SAS相关的java错误还是我的XSL文件的问题(请参阅下面的完整文件).``

<?xml version="1.0"?>

-<xsl:stylesheet xmlns:d7p1="http://www.w3.org/2001/XMLSchema" xmlns:d5p1="http://www.itron.com/ami/2008/10/events" xmlns:d3p1="http://www.itron.com/ami/2008/10/common" xmlns:d2p1="http://www.itron.com/ami/2008/10/data" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:itron="http://schemas.datacontract.org/2004/07/Itron.Ami.AmiServiceTest.Hosting" xmlns="http://www.w3.org/TR/REC-html40" xmlns:dt="urn:schemas-microsoft-com:datatypes" xmlns:local="#local-functions" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">


-<xsl:template match="/">

<div>AMI DATA</div>


-<xsl:for-each select="XMLRoot/itron:DataSubscriberItem">


-<div>

<xsl:variable select="itron:DataArrivedInput/d2p1:ReadDataCollection/d2p1:ReadData/d2p1:LoadProfileChannels/d2p1:LoadProfileChannel/d2p1:TimeDataEnd" name="EndTime"/>
Time Data End: 
<xsl:value-of select="$EndTime"/>

</div>


-<div>

<xsl:variable select="itron:DataArrivedInput/d2p1:ReadDataCollection/d2p1:ReadData/d2p1:LoadProfileChannels/d2p1:LoadProfileChannel/d2p1:PulseMultiplier" name="PulsMult"/>
Pulse Multiplier: 
<xsl:value-of select="$PulsMult"/>

</div>


-<div>
Meter ID: 
<xsl:value-of select="itron:DataArrivedInput/d2p1:ReadDataCollection/d2p1:ReadData/d2p1:Identifier"/>

</div>


-<table cellspacing="0" cellpadding="0" border="1">


-<tr style="background-color:#C0C0C0; font-weight:bold">

<td>Num</td>

<td>Vh(a)</td>

<td>Max V(a)</td>

<td>Min V(a)</td>

<td>Vh(c)</td>

<td>Max V(c)</td>

<td>Min V(c)</td>

<td>Timestamp</td>

</tr>

<xsl:variable select="count(itron:DataArrivedInput/d2p1:ReadDataCollection/d2p1:ReadData/d2p1:LoadProfileChannels/d2p1:LoadProfileChannel[1]/d2p1:IntervalValues/d2p1:IntervalValue)" name="NumPnts"/>


-<div>
Number of Points: 
<xsl:value-of select="$NumPnts"/>

</div>


-<xsl:for-each select="itron:DataArrivedInput/d2p1:ReadDataCollection/d2p1:ReadData/d2p1:LoadProfileChannels/d2p1:LoadProfileChannel[1]/d2p1:IntervalValues/d2p1:IntervalValue">

<xsl:variable select="position()" name="INum"/>

<xsl:variable select="../../d2p1:TimeDataEnd" name="EndTime2"/>


-<tr>


-<td>

<xsl:value-of select="$INum"/>

</td>

<xsl:variable select="d2p1:ChannelValue" name="Vha"/>


-<td>

<!--<xsl:value-of select="$Vha*$PulsMult"/>-->


<xsl:value-of select="format-number($Vha*$PulsMult,"0.###")"/>

</td>

<xsl:variable select="../../../d2p1:LoadProfileChannel[2]/d2p1:IntervalValues/d2p1:IntervalValue[$INum]/d2p1:ChannelValue" name="Vmaxa"/>


-<td>

<xsl:value-of select="format-number($Vmaxa*$PulsMult,"0.###")"/>

</td>

<xsl:variable select="../../../d2p1:LoadProfileChannel[3]/d2p1:IntervalValues/d2p1:IntervalValue[$INum]/d2p1:ChannelValue" name="Vmina"/>


-<td>

<xsl:value-of select="format-number($Vmina*$PulsMult,"0.###")"/>

</td>

<xsl:variable select="../../../d2p1:LoadProfileChannel[4]/d2p1:IntervalValues/d2p1:IntervalValue[$INum]/d2p1:ChannelValue" name="Vhc"/>


-<td>

<xsl:value-of select="format-number($Vhc*$PulsMult,"0.###")"/>

</td>

<xsl:variable select="../../../d2p1:LoadProfileChannel[5]/d2p1:IntervalValues/d2p1:IntervalValue[$INum]/d2p1:ChannelValue" name="Vmaxc"/>


-<td>

<xsl:value-of select="format-number($Vmaxc*$PulsMult,"0.###")"/>

</td>

<xsl:variable select="../../../d2p1:LoadProfileChannel[6]/d2p1:IntervalValues/d2p1:IntervalValue[$INum]/d2p1:ChannelValue" name="Vminc"/>


-<td>

<xsl:value-of select="format-number($Vminc*$PulsMult,"0.###")"/>

</td>


-<td>

<xsl:variable select="concat(substring($EndTime2, 1,10), ' ', substring($EndTime2, 12,5))" name="SDTS"/>

<xsl:value-of select="local:timeCalc($SDTS, $INum, $NumPnts)"/>

</td>

</tr>

</xsl:for-each>

</table>

<hr/>

</xsl:for-each>

</xsl:template>


-<msxsl:script language="VBScript" implements-prefix="local">

<![CDATA[ Function timeCalc(ET, PT, TP) SDT1 = CDate(ET) SDT = DateAdd("n", -(TP-PT)*5, SDT1) TTR = PadOut(Month(SDT)) & "/" & PadOut(Day(SDT)) & "/" & Year(SDT)& " " & PadOut(Hour(SDT)-4) & ":" & PadOut(Minute(SDT)) timeCalc = TTR End Function Function PadOut(n) If n < 10 Then PadOut = "0" & n Else PadOut = n End If End Function ]]>

</msxsl:script>

</xsl:stylesheet>

这是我的SAS代码

PROC XSL in='C:\SAS Files\input.XML'
    OUT='C:\SAS Files\output.XML'
    XSL='C:\SAS Files\stylesheet.xsl';
    run;

1 个答案:

答案 0 :(得分:1)

在表达式中使用不同的引号。

使用

select="format-number($Vha*$PulsMult,"0.###")"

而不是

{{1}}