从SOAP响应中,我收到了以下XML:
<?xml version="1.0" encoding="UTF-8"?>
<FindRelativesResponse xmlns="http://avid.com/interplay/ws/assets/types">
<Results>
<AssetDescription>
<InterplayURI>interplay://avideng103?mobid=060a2b340101010101010f0013-000000-53f2ae93b07200c3-060e2b347f7f-2a80</InterplayURI>
<Attributes>
<Attribute Name="MOB ID" Group="SYSTEM">060a2b340101010101010f0013-000000-53f2ae93b07200c3-060e2b347f7f-2a80</Attribute>
<Attribute Name="Moniker" Group="SYSTEM">1|F9E3A1A4-4CB9-45CC-A590-77A5D733B633|*|1121558|*</Attribute>
</Attributes>
</AssetDescription>
<AssetDescription>
<InterplayURI>interplay://avideng103?mobid=060a2b340101010101010f0013-000000-568ad56218ad42e7-060e2b347f7f-2a80</InterplayURI>
<Attributes>
<Attribute Name="MOB ID" Group="SYSTEM">060a2b340101010101010f0013-000000-568ad56218ad42e7-060e2b347f7f-2a80</Attribute>
<Attribute Name="Moniker" Group="SYSTEM">1|F9E3A1A4-4CB9-45CC-A590-77A5D733B633|*|4229098|*</Attribute>
<Attribute Name="CATDV RemoteID" Group="USER">11868</Attribute>
<Attribute Name="CATDV Animal" Group="USER">Tortoise</Attribute>
<Attribute Name="CATDV Director Approved" Group="USER">Director Approved</Attribute>
<Attribute Name="CATDV Location" Group="USER">Land</Attribute>
<Attribute Name="CATDV Time of Day" Group="USER">Day</Attribute>
</Attributes>
</AssetDescription>
</Results>
</FindRelativesResponse>
但是,我对此进行转换的正常尝试无效。我尝试过以下方法:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="1.0">
<xsl:template match = "/">
<test>
<xsl:value-of select="FindRelativesResponse/Results/AssetDescription/Attributes/Attribute[@Name = 'CATDV RemoteID']"/>
</test>
</xsl:template>
</xsl:stylesheet>
但是,结果在测试元素中只是空的。
我想知道它是否与此有关:<FindRelativesResponse xmlns="http://avid.com/interplay/ws/assets/types">
我不习惯看到这一点,所以我想知道是否有步骤我&#39 ; m在xslt中缺失。
以下是帮助回答问题所需的其他信息。我有多个名称空间,我不知道如何让它们正常工作,如上所列。这是我迄今为止所尝试的内容,特别是列出的<soa:Parameter>
上的<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:avid="http://avid.com/interplay/ws/assets/types"
xmlns:soa="urn:telestream.net:soa:core"
exclude-result-prefixes="avid"
version="1.0">
<xsl:template match = "/">
<soa:Label>
<soa:Parameter type="string" identifier="7c0c6642-5a4d-42b7-9945-303caffd2c57" bindable="True" name="CATDV Time of Day" enabled="true" disableable="false" optionseditable="false" row="-1" column="-1" columnspan="1">
<soa:IsRequired>false</soa:IsRequired>
</soa:Parameter>
<soa:Parameter type="string" identifier="ced9fe1e-d546-4b2e-9dd8-4ad94d701802" bindable="True" name="CATDV Director Approved" enabled="true" disableable="false" optionseditable="false" row="-1" column="-1" columnspan="1">
<soa:IsRequired>false</soa:IsRequired>
</soa:Parameter>
<soa:Parameter type="string" identifier="16aba128-da36-4e3e-b68a-b95792b15be8" bindable="True" name="CATDV Location" enabled="true" disableable="false" optionseditable="false" row="-1" column="-1" columnspan="1">
<soa:IsRequired>false</soa:IsRequired>
</soa:Parameter>
<soa:Parameter type="string" identifier="930630e1-7697-4514-9aa4-d00d536db664" bindable="True" name="CATDV Animal" enabled="true" disableable="false" optionseditable="false" row="-1" column="-1" columnspan="1">
<soa:IsRequired>false</soa:IsRequired>
</soa:Parameter>
<soa:Parameter type="string" identifier="6a2319d4-4894-4268-8f71-186c2b8cf39a" bindable="True" name="CATDV Remote ID" enabled="true" disableable="false" optionseditable="false" row="-1" column="-1" columnspan="1"><xsl:value-of select= "avid:FindRelativesResponse/avid:Results/avid:AssetDescription/avid:Attributes/avid:Attribute[@Name = 'CATDV Remote ID']"></xsl:value-of>
<soa:IsRequired>false</soa:IsRequired>
</soa:Parameter>
<soa:Parameter type="string" identifier="7a05829d-0a73-4cf0-a075-ef4d26f95c2a" bindable="True" name="Reference Asset MOB ID" enabled="true" disableable="false" optionseditable="false" row="-1" column="-1" columnspan="1">
<soa:IsRequired>false</soa:IsRequired>
</soa:Parameter>
</soa:Label>
</xsl:template>
</xsl:stylesheet>
:
.controller("changeTitleCtrl",function($http, $scope) {
$scope.setInEnd = function(value) {
$http.put('/api/put', { 'title': "End" }).success(function() {
alert("Works")
location.reload();
}).error(function() {
alert("error");
});
};
})
答案 0 :(得分:1)
我想知道它是否与此有关:
<FindRelativesResponse xmlns="http://avid.com/interplay/ws/assets/types">
肯定会这样。试试这种方式:
- 经过编辑以符合您新增的要求: -
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:soa="urn:telestream.net:soa:core"
xmlns:avid="http://avid.com/interplay/ws/assets/types"
exclude-result-prefixes="avid">
<xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/>
<xsl:template match="/">
<soa:Label>
<soa:Parameter type="string" identifier="7c0c6642-5a4d-42b7-9945-303caffd2c57" bindable="True" name="CATDV Time of Day" enabled="true" disableable="false" optionseditable="false" row="-1" column="-1" columnspan="1">
<soa:IsRequired>false</soa:IsRequired>
</soa:Parameter>
<soa:Parameter type="string" identifier="ced9fe1e-d546-4b2e-9dd8-4ad94d701802" bindable="True" name="CATDV Director Approved" enabled="true" disableable="false" optionseditable="false" row="-1" column="-1" columnspan="1">
<soa:IsRequired>false</soa:IsRequired>
</soa:Parameter>
<soa:Parameter type="string" identifier="16aba128-da36-4e3e-b68a-b95792b15be8" bindable="True" name="CATDV Location" enabled="true" disableable="false" optionseditable="false" row="-1" column="-1" columnspan="1">
<soa:IsRequired>false</soa:IsRequired>
</soa:Parameter>
<soa:Parameter type="string" identifier="930630e1-7697-4514-9aa4-d00d536db664" bindable="True" name="CATDV Animal" enabled="true" disableable="false" optionseditable="false" row="-1" column="-1" columnspan="1">
<soa:IsRequired>false</soa:IsRequired>
</soa:Parameter>
<soa:Parameter type="string" identifier="6a2319d4-4894-4268-8f71-186c2b8cf39a" bindable="True" name="CATDV Remote ID" enabled="true" disableable="false" optionseditable="false" row="-1" column="-1" columnspan="1">
<xsl:value-of select="avid:FindRelativesResponse/avid:Results/avid:AssetDescription/avid:Attributes/avid:Attribute[@Name = 'CATDV RemoteID']"/>
<soa:IsRequired>false</soa:IsRequired>
</soa:Parameter>
<soa:Parameter type="string" identifier="7a05829d-0a73-4cf0-a075-ef4d26f95c2a" bindable="True" name="Reference Asset MOB ID" enabled="true" disableable="false" optionseditable="false" row="-1" column="-1" columnspan="1">
<soa:IsRequired>false</soa:IsRequired>
</soa:Parameter>
</soa:Label>
</xsl:template>
</xsl:stylesheet>