Forum Moderators: open
The XML of course just has the numeric value. Is there some way that I can do a lookup during the XSL Transformation to get the corresponding annotation/documentation node? I would like to display the numeric value followed by the corresponding documentation text.
Hopefully that made sense. All help is appreciated!
<xsl:value-of select="document('ndex.xsd')/xsd:schema/xsd:simpleType[@name='AssociationCodePersonType']/xsd:restriction[@base='xsd:token']/xsd:enumeration[@value='1']/xsd:annotation/xsd:documentation"/>yyyy
I am doing this from an .aspx file (ASP.Net). I am certain that I have used the document function with MS XML transformations in the past, so I don't think that is a contributing factor.
I should also mention that this is a server-side transformation, and is not being done on the client machine.
I am certain that the XPath to the node is correct, but if it will help, I can post or PM the schema.
The second section is a simplified version of the schema file that I am trying to get at with the document() function. I have removed all but one simpleType. And from that remaining type, I have removed most of the enumeration nodes.
XSLT file:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:jxdd="http://www.it.ojp.gov/jxdm/3.0.2"
xmlns:ndex="http://www.ndex.gov/1.0.3"
xmlns:inc="http://caseincidentreport.com/1.0.3"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsl:output method="html" indent="yes" encoding="UTF-8"/><xsl:template match="inc:CaseIncidentReport">
<xsl:apply-templates select="inc:Incident"/>
</xsl:template><xsl:template match="inc:Incident">
***<xsl:value-of select="document('ndexTEST.xsd')/xsd:schema/xsd:simpleType[@name='AssociationCodePersonType']/xsd:restriction[@base='xsd:token']/xsd:enumeration[@value='1']/xsd:annotation/xsd:documentation"/>line 1<br/>
***<xsl:value-of select="document('//localhost/wsIBRClientSite/Styles/XSLT/ndexTEST.xsd')/xsd:schema/xsd:simpleType[@name='AssociationCodePersonType']/xsd:restriction[@base='xsd:token']/xsd:enumeration[@value='1']/xsd:annotation/xsd:documentation"/>line 2<br/>
***<xsl:value-of select="document('../Styles/XSLT/ndexTEST.xsd')/xsd:schema/xsd:simpleType[@name='AssociationCodePersonType']/xsd:restriction[@base='xsd:token']/xsd:enumeration[@value='1']/xsd:annotation/xsd:documentation"/>line 3<br/>
***<xsl:value-of select="document('http:ndexTEST.xsd')/xsd:schema/xsd:simpleType[@name='AssociationCodePersonType']/xsd:restriction[@base='xsd:token']/xsd:enumeration[@value='1']/xsd:annotation/xsd:documentation"/>line 4<br/>
***<xsl:value-of select="document('http://localhost/wsIBRClientSite/Styles/XSLT/ndexTEST.xsd')/xsd:schema/xsd:simpleType[@name='AssociationCodePersonType']/xsd:restriction[@base='xsd:token']/xsd:enumeration[@value='1']/xsd:annotation/xsd:documentation"/>line 5<br/>
***<xsl:value-of select="document('http:../Styles/XSLT/ndexTEST.xsd')/xsd:schema/xsd:simpleType[@name='AssociationCodePersonType']/xsd:restriction[@base='xsd:token']/xsd:enumeration[@value='1']/xsd:annotation/xsd:documentation"/>line 6<br/>
***<xsl:value-of select="document('file:ndexTEST.xsd')/xsd:schema/xsd:simpleType[@name='AssociationCodePersonType']/xsd:restriction[@base='xsd:token']/xsd:enumeration[@value='1']/xsd:annotation/xsd:documentation"/>line 7<br/>
***<xsl:value-of select="document('file:c:\inetpub\wwwroot\wsIBRClientSite\Styles\XSLT\ndexTEST.xsd')/xsd:schema/xsd:simpleType[@name='AssociationCodePersonType']/xsd:restriction[@base='xsd:token']/xsd:enumeration[@value='1']/xsd:annotation/xsd:documentation"/>line 8<br/>
***<xsl:value-of select="document('file://c/inetpub/wwwroot/wsIBRClientSite/Styles/XSLT/ndexTEST.xsd')/xsd:schema/xsd:simpleType[@name='AssociationCodePersonType']/xsd:restriction[@base='xsd:token']/xsd:enumeration[@value='1']/xsd:annotation/xsd:documentation"/>line 9<br/>
</xsl:template></xsl:stylesheet>
External Schema File (ndexTEST.xsd):
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://www.ndex.gov/1.0.3" xmlns="http://www.ndex.gov/1.0.3" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xsd:simpleType name="AssociationCodePersonType">
<xsd:annotation>
<xsd:documentation>A code list that enumerates types of relationships between persons.</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:token">
<xsd:enumeration value="1">
<xsd:annotation>
<xsd:documentation>Relationship Unknown</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="2">
<xsd:annotation>
<xsd:documentation>Otherwise Known</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="3">
<xsd:annotation>
<xsd:documentation>Spouse</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="4">
<xsd:annotation>
<xsd:documentation>Common-Law Spouse</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="5">
<xsd:annotation>
<xsd:documentation>Parent</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="6">
<xsd:annotation>
<xsd:documentation>Sibling</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="7">
<xsd:annotation>
<xsd:documentation>Child</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="8">
<xsd:annotation>
<xsd:documentation>Grandparent</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="9">
<xsd:annotation>
<xsd:documentation>Grandchild</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
#######################
***Relationship Unknownline 1<br xmlns:jxdd="http://www.it.ojp.gov/jxdm/3.0.2" xmlns:ndex="http://www.ndex.gov/1.0.3" xmlns:inc="http://caseincidentreport.com/1.0.3" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
***Relationship Unknownline 2<br xmlns:jxdd="http://www.it.ojp.gov/jxdm/3.0.2" xmlns:ndex="http://www.ndex.gov/1.0.3" xmlns:inc="http://caseincidentreport.com/1.0.3" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
***Relationship Unknownline 3<br xmlns:jxdd="http://www.it.ojp.gov/jxdm/3.0.2" xmlns:ndex="http://www.ndex.gov/1.0.3" xmlns:inc="http://caseincidentreport.com/1.0.3" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
***Relationship Unknownline 4<br xmlns:jxdd="http://www.it.ojp.gov/jxdm/3.0.2" xmlns:ndex="http://www.ndex.gov/1.0.3" xmlns:inc="http://caseincidentreport.com/1.0.3" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
***Relationship Unknownline 5<br xmlns:jxdd="http://www.it.ojp.gov/jxdm/3.0.2" xmlns:ndex="http://www.ndex.gov/1.0.3" xmlns:inc="http://caseincidentreport.com/1.0.3" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
***Relationship Unknownline 6<br xmlns:jxdd="http://www.it.ojp.gov/jxdm/3.0.2" xmlns:ndex="http://www.ndex.gov/1.0.3" xmlns:inc="http://caseincidentreport.com/1.0.3" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
***Relationship Unknownline 7<br xmlns:jxdd="http://www.it.ojp.gov/jxdm/3.0.2" xmlns:ndex="http://www.ndex.gov/1.0.3" xmlns:inc="http://caseincidentreport.com/1.0.3" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
***Relationship Unknownline 8<br xmlns:jxdd="http://www.it.ojp.gov/jxdm/3.0.2" xmlns:ndex="http://www.ndex.gov/1.0.3" xmlns:inc="http://caseincidentreport.com/1.0.3" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
***Relationship Unknownline 9<br xmlns:jxdd="http://www.it.ojp.gov/jxdm/3.0.2" xmlns:ndex="http://www.ndex.gov/1.0.3" xmlns:inc="http://caseincidentreport.com/1.0.3" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
xalan-2.6.0
##################
***Relationship Unknownline 1<br xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:inc="http://caseincidentreport.com/1.0.3" xmlns:ndex="http://www.ndex.gov/1.0.3" xmlns:jxdd="http://www.it.ojp.gov/jxdm/3.0.2">
***Relationship Unknownline 2<br>
***Relationship Unknownline 3<br>
***Relationship Unknownline 4<br>
***Relationship Unknownline 5<br>
***Relationship Unknownline 6<br>
***Relationship Unknownline 7<br>
***Relationship Unknownline 8<br>
***Relationship Unknownline 9<br>
Different outputs from 2 different processors. I think my version of xsltproc is a bit old. I would check the version of the xslt processor you're using.
Made a minor change just to use my dummy xml file
<xsl:template match="/">
<xsl:apply-templates select="books/book"/>
</xsl:template>
<xsl:template match="books/book">
.... as per your template........
</xsl:template>
Just for grins, I tried this with a classic ASP page and it works. The difference is that the ASP functions utilize the MSXML DOM objects.
MicroSoft support staff will never be in want of a job, that's for sure.
It is quite possibly an issue with security rights to a temp directory or something like that. So I will pursue that angle for awhile. Thanks again!
Anyway, here is the simple phrase that would have helped: If you are using .Net to do XSLT and you want to use the document() function, then you need to pass an XmlUrlResolver instance in the call to the Transform method. There are probably exceptions.
Hopefully that will show up in Google for the next person that has this question.