XPATH/XSLT Trouble with Complex Schema
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 14
- Joined: Mon Feb 09, 2009 5:49 pm
XPATH/XSLT Trouble with Complex Schema
I've simplified my schema and am starting over with a cleaner example.
I'm having trouble with this schema and performing an xpath query on sub-nodes. The XSD has been obfuscated and simplified from the original as I don't have permission to post it.
I'm using Saxon/SA as the transformer, no special options turned on.
I can xpath into the node I want directly (/XXX/XXXAa) but have trouble within a template match. Inside the template match (line 17 of the first template) if I ctrl-space I only get attribute code completion, and not nodes. If I force the match to a node name and run/debug the transform I also don't get a match.
I think there is an issue with how the schema is using complex types, but I don't fully understand why. I'm wondering if anyone else can suggest what I'm doing wrong.
xToTABexample.xslt
Included toTAB.xslt
Sample XML (generated from schema):
SDR-small-example.xsd
I'm having trouble with this schema and performing an xpath query on sub-nodes. The XSD has been obfuscated and simplified from the original as I don't have permission to post it.
I'm using Saxon/SA as the transformer, no special options turned on.
I can xpath into the node I want directly (/XXX/XXXAa) but have trouble within a template match. Inside the template match (line 17 of the first template) if I ctrl-space I only get attribute code completion, and not nodes. If I force the match to a node name and run/debug the transform I also don't get a match.
I think there is an issue with how the schema is using complex types, but I don't fully understand why. I'm wondering if anyone else can suggest what I'm doing wrong.
xToTABexample.xslt
Code: Select all
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2004/10/xpath-functions"
xmlns:xdt="http://www.w3.org/2004/10/xpath-datatypes"
xmlns:tab="http://www.ora.com/XSLTCookbook/namespaces/tab">
<xsl:import href="toTAB.xslt"/>
<!--Defines the mapping from attributes to columns -->
<!--
<xsl:variable name="columns" select="'NamePrefix', 'FullName', 'CompanyName', 'LastName','FirstName','Initial', 'NamePostfix', 'Title', 'Telephone', 'TelephoneExt', 'Fax', 'Email'" as="xs:string*"/>
-->
<xsl:variable name="columns"
select="'NameBd', 'BeName', 'BfName', 'BgName','BhName','Bi', 'NameBl', 'Bm', 'Bn', 'BnBo', 'Bp', 'Bq'"
as="xs:string*"/>
<xsl:template match="XXX" mode="tab:map-row" >
<xsl:apply-templates select="XXXAb" mode="tab:map-row"/>
</xsl:template>
<!-- Switch default processing from elements to attributes -->
<xsl:template match="XXXAb" mode="tab:map-row">
<xsl:call-template name="tab:map-row">
<xsl:with-param name="elemOrAttr" select=" 'elem' "/>
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>
Code: Select all
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2004/10/xpath-functions"
xmlns:tab="http://www.ora.com/XSLTCookbook/namespaces/tab"
xmlns:functx="http://www.functx.com">
<xsl:function name="functx:atomic-type" as="xs:string*"
xmlns:functx="http://www.functx.com" >
<xsl:param name="values" as="xs:anyAtomicType*"/>
<xsl:sequence select="
for $val in $values
return
(if ($val instance of xs:untypedAtomic) then 'xs:untypedAtomic'
else if ($val instance of xs:anyURI) then 'xs:anyURI'
else if ($val instance of xs:string) then 'xs:string'
else if ($val instance of xs:QName) then 'xs:QName'
else if ($val instance of xs:boolean) then 'xs:boolean'
else if ($val instance of xs:base64Binary) then 'xs:base64Binary'
else if ($val instance of xs:hexBinary) then 'xs:hexBinary'
else if ($val instance of xs:integer) then 'xs:integer'
else if ($val instance of xs:decimal) then 'xs:decimal'
else if ($val instance of xs:float) then 'xs:float'
else if ($val instance of xs:double) then 'xs:double'
else if ($val instance of xs:date) then 'xs:date'
else if ($val instance of xs:time) then 'xs:time'
else if ($val instance of xs:dateTime) then 'xs:dateTime'
else if ($val instance of xs:dayTimeDuration)
then 'xs:dayTimeDuration'
else if ($val instance of xs:yearMonthDuration)
then 'xs:yearMonthDuration'
else if ($val instance of xs:duration) then 'xs:duration'
else if ($val instance of xs:gMonth) then 'xs:gMonth'
else if ($val instance of xs:gYear) then 'xs:gYear'
else if ($val instance of xs:gYearMonth) then 'xs:gYearMonth'
else if ($val instance of xs:gDay) then 'xs:gDay'
else if ($val instance of xs:gMonthDay) then 'xs:gMonthDay'
else 'unknown')
"/>
</xsl:function>
<xsl:function name="tab:right-trim" as="xs:string">
<xsl:param name="arg"/>
<xsl:sequence select="
replace($arg,'\s+$','')
"/>
</xsl:function>
<xsl:param name="delimiter" select=" '	' "/>
<!--These should be overridden in importing stylesheet -->
<xsl:variable name="columns" select="()" as="xs:string*"/>
<xsl:variable name="nodeNames" select="$columns" as="xs:string*"/>
<xsl:output method="text"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<!-- Write out column headings -->
<xsl:value-of select="$columns" separator="{$delimiter}"/>
<xsl:text>
</xsl:text>
<!-- Process each row -->
<xsl:apply-templates mode="tab:map-row"/>
</xsl:template>
<xsl:template match="*" mode="tab:map-row" name="tab:map-row">
<xsl:param name="elemOrAttr" select=" 'elem' " as="xs:string"/>
<xsl:variable name="row" select="." as="node()"/>
<xsl:for-each select="$nodeNames">
<xsl:apply-templates
select="if ($elemOrAttr eq 'elem')
then $row/*[local-name(.) eq current()]
else $row/@*[local-name(.) eq current()]"
mode="tab:map-value"/>
<xsl:value-of select="if (position() ne last()) then $delimiter else ()"/>
</xsl:for-each>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="node()" mode="tab:map-value">
<xsl:value-of select="
if(functx:atomic-type(.) = 'xs:string')
then tab:right-trim(.)
else if(functx:atomic-type(.) = 'xs:dateTime')
then format-dateTime(., '[Y0001]-[M01]-[D01] [H01]:[m01]:[s01].0000')
else ."/>
</xsl:template>
</xsl:stylesheet>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<XXX xmlns="https://www.Cc.org/XXX.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://www.Cc.org/XXX.xsd file:/Y:/sdr/SDR-small-example.xsd" XXXAbAc="ZGVmYXVsdA==" SchemaAd="SchemaAd1">
<XXXAa>
<AeAfAg>
<NameBd>Mra</NameBd>
<BeName>BeName0</BeName>
<BfName>BfName0</BfName>
<BgName>BgName0</BgName>
<BhName>BhName0</BhName>
<Bi>A</Bi>
<NameBl>Jra</NameBl>
<Bm>Bm0</Bm>
<Bn>N/A</Bn>
<BnBo>49999</BnBo>
<Bp>1001000000</Bp>
<Bq>0@0.AA</Bq>
</AeAfAg>
<AeAh>AeAh0</AeAh>
<AiByAeAj>AiByAeAj0</AiByAeAj>
<XXXAkName>XXXAkName0</XXXAkName>
</XXXAa>
</XXX>
Code: Select all
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<xs:schema xmlns:sdr="https://www.Cc.org/XXX.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="https://www.Cc.org/XXX.xsd"
elementFormDefault="qualified" attributeFormDefault="unqualified" id="XXX">
<xs:annotation>
<xs:documentation xml:lang="en">XXX Schema Bx Bz . All rights
reserved.</xs:documentation>
</xs:annotation>
<xs:annotation>
<xs:documentation xml:lang="en">XXX Schema V Cb Bx Ca . All rights
reserved.</xs:documentation>
</xs:annotation>
<xs:element name="XXXAa" type="sdr:XXXAaType"/>
<xs:element name="XXX">
<xs:complexType>
<xs:all>
<xs:element ref="sdr:XXXAa"/>
</xs:all>
<xs:attribute name="XXXAbAc" type="sdr:XXXAbType" use="optional"/>
<xs:attribute name="SchemaAd" type="xs:string" use="optional"/>
</xs:complexType>
</xs:element>
<xs:simpleType name="XXXAbType">
<xs:restriction base="xs:base64Binary">
<xs:maxLength value="10000"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="XXXAaType">
<xs:all>
<xs:element name="AeAfAg" type="sdr:AfAgType" minOccurs="0"/>
<xs:element name="AeAh" type="xs:string" minOccurs="0"/>
<xs:element name="AiByAeAj" type="xs:string" minOccurs="0"/>
<xs:element name="XXXAkName" type="xs:string" minOccurs="0"/>
<!--
add more XXX header info HERE
xml file version maybe
etc...
-->
</xs:all>
</xs:complexType>
<xs:complexType name="AlAmType">
<xs:all>
<xs:element name="An" type="sdr:BsBr50CharType" minOccurs="0"/>
<xs:element name="AmAo1">
<xs:simpleType>
<xs:union>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType>
<xs:restriction base="sdr:BuBvType"/>
</xs:simpleType>
</xs:union>
</xs:simpleType>
</xs:element>
<xs:element name="AmAo2" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="AmAo3" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="City">
<xs:simpleType>
<xs:union>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType>
<xs:restriction base="sdr:BuBvType"/>
</xs:simpleType>
</xs:union>
</xs:simpleType>
</xs:element>
<xs:element name="ApOrState" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="AqAr" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="As" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:all>
</xs:complexType>
<xs:complexType name="AmType">
<xs:all>
<xs:element name="An" type="sdr:BsBr50CharType" minOccurs="0"/>
<xs:element name="AtAu" minOccurs="0">
<xs:simpleType>
<xs:union memberTypes="sdr:BsBr10CharType sdr:BuBvType"/>
</xs:simpleType>
</xs:element>
<xs:element name="AtAv" type="sdr:BsBr3CharType" minOccurs="0"/>
<xs:element name="AtAw" type="sdr:AtAwType" minOccurs="0"/>
<xs:element name="AtName" minOccurs="0">
<xs:simpleType>
<xs:union memberTypes="sdr:BsBr50CharType sdr:BuBvType"/>
</xs:simpleType>
</xs:element>
<xs:element name="AtAx" type="sdr:BbAtAxType" minOccurs="0"/>
<xs:element name="AyType" type="sdr:BbAyBwType" minOccurs="0"/>
<xs:element name="AyAu" type="sdr:BsBr10CharType" minOccurs="0"/>
<xs:element name="AzBa" type="sdr:BsBr10CharType" minOccurs="0"/>
<xs:element name="City">
<xs:simpleType>
<xs:union memberTypes="sdr:BsBr25CharType sdr:BuBvType"/>
</xs:simpleType>
</xs:element>
<xs:element name="State">
<xs:simpleType>
<xs:union memberTypes="sdr:StateType sdr:BuBvType"/>
</xs:simpleType>
</xs:element>
<xs:element name="BcAr">
<xs:simpleType>
<xs:union memberTypes="sdr:BuBvType sdr:BcArType"/>
</xs:simpleType>
</xs:element>
</xs:all>
</xs:complexType>
<xs:complexType name="AfAgType">
<xs:all>
<xs:element name="NameBd" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="Mr.|Mrs.|Ms.|Sir"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="BeName">
<xs:simpleType>
<xs:union memberTypes="sdr:BsBr50CharType sdr:BuBvType"/>
</xs:simpleType>
</xs:element>
<xs:element name="BfName" type="sdr:BsBr50CharType" minOccurs="0"/>
<xs:element name="BgName" type="sdr:BsBr25CharType" minOccurs="0"/>
<xs:element name="BhName" type="sdr:BsBr25CharType" minOccurs="0"/>
<xs:element name="Bi" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="1"/>
<xs:pattern value="[a-zA-Z]"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="NameBl" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="Jr.|Sr."/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Bm" type="sdr:BsBr50CharType" minOccurs="0"/>
<xs:element name="Bn">
<xs:simpleType>
<xs:union memberTypes="sdr:BuBvType sdr:BtAuType"/>
</xs:simpleType>
</xs:element>
<xs:element name="BnBo" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="99999"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Bp" type="sdr:BtAuType" minOccurs="0"/>
<xs:element name="Bq" type="sdr:BqType" minOccurs="0"/>
</xs:all>
</xs:complexType>
<xs:simpleType name="StateType">
<xs:restriction base="xs:string">
<xs:pattern
value="(A[LKSZRAP]|C[AOT]|D[EC]|F[LM]|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEHINOPST]|N[CDEHJMVY]|O[HKR]|P[ARW]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])"
/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="BcArType">
<xs:restriction base="xs:string">
<xs:pattern value="\d{5}(-\d{4})?"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="XXXStringType">
<xs:restriction base="xs:string">
<xs:pattern value="[a-zA-Z0-9\s.\-/_'(),{}@$!#&%]+"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="BsBr3CharType">
<xs:restriction base="sdr:XXXStringType">
<xs:maxLength value="3"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="BsBr10CharType">
<xs:restriction base="sdr:XXXStringType">
<xs:maxLength value="10"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="BsBr25CharType">
<xs:restriction base="sdr:XXXStringType">
<xs:maxLength value="25"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="BsBr50CharType">
<xs:restriction base="sdr:XXXStringType">
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="AtAwType">
<xs:restriction base="xs:string">
<xs:pattern value="n|N|s|S|w|W|e|E|ne|Ne|nE|NE|nw|Nw|nW|NW|se|Se|sE|SE|sw|Sw|sW|SW"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="BtAuType">
<xs:restriction base="xs:string">
<xs:pattern value="\(?[1-9][0-9][0-9]\)?-?[1-9][0-9][0-9]-?[0-9][0-9][0-9][0-9]"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="BqType">
<xs:restriction base="xs:string">
<xs:pattern
value="([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@(([0-9a-zA-Z])+([-\w]*[0-9a-zA-Z])*\.)+[a-zA-Z]{2,9})"
/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="BuBvType">
<xs:restriction base="xs:string">
<xs:pattern value="N/A|n/a"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="BbAyBwType">
<xs:restriction base="xs:string">
<xs:enumeration value="APT"/>
<xs:enumeration value="BSMT"/>
<xs:enumeration value="BLDG"/>
<xs:enumeration value="DEPT"/>
<xs:enumeration value="FL"/>
<xs:enumeration value="FRNT"/>
<xs:enumeration value="HNGR"/>
<xs:enumeration value="LBBY"/>
<xs:enumeration value="LOT"/>
<xs:enumeration value="LOWR"/>
<xs:enumeration value="OFC"/>
<xs:enumeration value="PH"/>
<xs:enumeration value="PIER"/>
<xs:enumeration value="REAR"/>
<xs:enumeration value="RM"/>
<xs:enumeration value="SIDE"/>
<xs:enumeration value="SLIP"/>
<xs:enumeration value="SPC"/>
<xs:enumeration value="STOP"/>
<xs:enumeration value="STE"/>
<xs:enumeration value="TRLR"/>
<xs:enumeration value="UNIT"/>
<xs:enumeration value="UPPR"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="BbAtAxType">
<xs:restriction base="xs:string">
<xs:enumeration value="ALY"/>
<xs:enumeration value="ANX"/>
<xs:enumeration value="ARC"/>
<xs:enumeration value="AVE"/>
<xs:enumeration value="BCH"/>
<xs:enumeration value="BG"/>
<xs:enumeration value="BGS"/>
<xs:enumeration value="BLF"/>
<xs:enumeration value="BLFS"/>
<xs:enumeration value="BLVD"/>
<xs:enumeration value="BND"/>
<xs:enumeration value="BR"/>
<xs:enumeration value="BRG"/>
<xs:enumeration value="BRK"/>
<xs:enumeration value="BRKS"/>
<xs:enumeration value="BTM"/>
<xs:enumeration value="BYP"/>
<xs:enumeration value="BYU"/>
<xs:enumeration value="CIR"/>
<xs:enumeration value="CIRS"/>
<xs:enumeration value="CLB"/>
<xs:enumeration value="CLF"/>
<xs:enumeration value="CLFS"/>
<xs:enumeration value="CMN"/>
<xs:enumeration value="COR"/>
<xs:enumeration value="CORS"/>
<xs:enumeration value="CP"/>
<xs:enumeration value="CPE"/>
<xs:enumeration value="CRES"/>
<xs:enumeration value="CRK"/>
<xs:enumeration value="CRSE"/>
<xs:enumeration value="CRST"/>
<xs:enumeration value="CSWY"/>
<xs:enumeration value="CT"/>
<xs:enumeration value="CTR"/>
<xs:enumeration value="CTRS"/>
<xs:enumeration value="CTS"/>
<xs:enumeration value="CURV"/>
<xs:enumeration value="CV"/>
<xs:enumeration value="CVS"/>
<xs:enumeration value="CYN"/>
<xs:enumeration value="DL"/>
<xs:enumeration value="DM"/>
<xs:enumeration value="DR"/>
<xs:enumeration value="DRS"/>
<xs:enumeration value="DV"/>
<xs:enumeration value="EST"/>
<xs:enumeration value="ESTS"/>
<xs:enumeration value="EXPY"/>
<xs:enumeration value="EXT"/>
<xs:enumeration value="EXTS"/>
<xs:enumeration value="FALL"/>
<xs:enumeration value="FLD"/>
<xs:enumeration value="FLDS"/>
<xs:enumeration value="FLS"/>
<xs:enumeration value="FLT"/>
<xs:enumeration value="FLTS"/>
<xs:enumeration value="FRD"/>
<xs:enumeration value="FRDS"/>
<xs:enumeration value="FRG"/>
<xs:enumeration value="FRGS"/>
<xs:enumeration value="FRK"/>
<xs:enumeration value="FRKS"/>
<xs:enumeration value="FRST"/>
<xs:enumeration value="FRY"/>
<xs:enumeration value="FT"/>
<xs:enumeration value="FWY"/>
<xs:enumeration value="GDN"/>
<xs:enumeration value="GDNS"/>
<xs:enumeration value="GLN"/>
<xs:enumeration value="GLNS"/>
<xs:enumeration value="GRN"/>
<xs:enumeration value="GRNS"/>
<xs:enumeration value="GRV"/>
<xs:enumeration value="GRVS"/>
<xs:enumeration value="GTWY"/>
<xs:enumeration value="HBR"/>
<xs:enumeration value="HBRS"/>
<xs:enumeration value="HL"/>
<xs:enumeration value="HLS"/>
<xs:enumeration value="HOLW"/>
<xs:enumeration value="HTS"/>
<xs:enumeration value="HVN"/>
<xs:enumeration value="HWY"/>
<xs:enumeration value="INLT"/>
<xs:enumeration value="IS"/>
<xs:enumeration value="ISLE"/>
<xs:enumeration value="ISS"/>
<xs:enumeration value="JCT"/>
<xs:enumeration value="JCTS"/>
<xs:enumeration value="KNL"/>
<xs:enumeration value="KNLS"/>
<xs:enumeration value="KY"/>
<xs:enumeration value="KYS"/>
<xs:enumeration value="LAND"/>
<xs:enumeration value="LCK"/>
<xs:enumeration value="LCKS"/>
<xs:enumeration value="LDG"/>
<xs:enumeration value="LF"/>
<xs:enumeration value="LGT"/>
<xs:enumeration value="LGTS"/>
<xs:enumeration value="LK"/>
<xs:enumeration value="LKS"/>
<xs:enumeration value="LN"/>
<xs:enumeration value="LNDG"/>
<xs:enumeration value="LOOP"/>
<xs:enumeration value="MALL"/>
<xs:enumeration value="MDW"/>
<xs:enumeration value="MDWS"/>
<xs:enumeration value="MEWS"/>
<xs:enumeration value="ML"/>
<xs:enumeration value="MLS"/>
<xs:enumeration value="MNR"/>
<xs:enumeration value="MNRS"/>
<xs:enumeration value="MSN"/>
<xs:enumeration value="MT"/>
<xs:enumeration value="MTN"/>
<xs:enumeration value="MTNS"/>
<xs:enumeration value="MTWY"/>
<xs:enumeration value="NCK"/>
<xs:enumeration value="OPAS"/>
<xs:enumeration value="ORCH"/>
<xs:enumeration value="OVAL"/>
<xs:enumeration value="PARK"/>
<xs:enumeration value="PARK"/>
<xs:enumeration value="PASS"/>
<xs:enumeration value="PATH"/>
<xs:enumeration value="PIKE"/>
<xs:enumeration value="PKWY"/>
<xs:enumeration value="PKWY"/>
<xs:enumeration value="PL"/>
<xs:enumeration value="PLN"/>
<xs:enumeration value="PLNS"/>
<xs:enumeration value="PLZ"/>
<xs:enumeration value="PNE"/>
<xs:enumeration value="PNES"/>
<xs:enumeration value="PR"/>
<xs:enumeration value="PRT"/>
<xs:enumeration value="PRTS"/>
<xs:enumeration value="PSGE"/>
<xs:enumeration value="PT"/>
<xs:enumeration value="PTS"/>
<xs:enumeration value="RADL"/>
<xs:enumeration value="RAMP"/>
<xs:enumeration value="RD"/>
<xs:enumeration value="RDG"/>
<xs:enumeration value="RDGS"/>
<xs:enumeration value="RDS"/>
<xs:enumeration value="RIV"/>
<xs:enumeration value="RNCH"/>
<xs:enumeration value="ROW"/>
<xs:enumeration value="RPD"/>
<xs:enumeration value="RPDS"/>
<xs:enumeration value="RST"/>
<xs:enumeration value="RTE"/>
<xs:enumeration value="RUE"/>
<xs:enumeration value="RUN"/>
<xs:enumeration value="SHL"/>
<xs:enumeration value="SHLS"/>
<xs:enumeration value="SHR"/>
<xs:enumeration value="SHRS"/>
<xs:enumeration value="SKWY"/>
<xs:enumeration value="SMT"/>
<xs:enumeration value="SPG"/>
<xs:enumeration value="SPGS"/>
<xs:enumeration value="SPUR"/>
<xs:enumeration value="SPUR"/>
<xs:enumeration value="SQ"/>
<xs:enumeration value="SQS"/>
<xs:enumeration value="ST"/>
<xs:enumeration value="STA"/>
<xs:enumeration value="STRA"/>
<xs:enumeration value="STRM"/>
<xs:enumeration value="STS"/>
<xs:enumeration value="TER"/>
<xs:enumeration value="TPKE"/>
<xs:enumeration value="TRAK"/>
<xs:enumeration value="TRCE"/>
<xs:enumeration value="TRFY"/>
<xs:enumeration value="TRL"/>
<xs:enumeration value="TRWY"/>
<xs:enumeration value="TUNL"/>
<xs:enumeration value="UN"/>
<xs:enumeration value="UNS"/>
<xs:enumeration value="UPAS"/>
<xs:enumeration value="VIA"/>
<xs:enumeration value="VIS"/>
<xs:enumeration value="VL"/>
<xs:enumeration value="VLG"/>
<xs:enumeration value="VLGS"/>
<xs:enumeration value="VLY"/>
<xs:enumeration value="VLYS"/>
<xs:enumeration value="VW"/>
<xs:enumeration value="VWS"/>
<xs:enumeration value="WALK"/>
<xs:enumeration value="WALK"/>
<xs:enumeration value="WALL"/>
<xs:enumeration value="WAY"/>
<xs:enumeration value="WAYS"/>
<xs:enumeration value="WL"/>
<xs:enumeration value="WLS"/>
<xs:enumeration value="XING"/>
<xs:enumeration value="XRD"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
Last edited by djharris on Thu Mar 05, 2009 1:17 am, edited 10 times in total.
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Re: XPATH/XSLT Trouble with Complex Schema
Look at XPath default namespace.
In XSLT/XPath 1.0 all the name tests (like the XXX name test from your template match) without a prefix will match that name from no namespace. In XSLT/XPath 2.0 it is possible to specify the namespace for name tests that do not have a prefix and you can do that with the xpath-default-namespace attribute. For example if you add
on the xsl:stylesheet element from both your XSLT files then you will get the behavior you expect, that is the template matching on XXX wil match the root element of your document.
Best Regards,
George
In XSLT/XPath 1.0 all the name tests (like the XXX name test from your template match) without a prefix will match that name from no namespace. In XSLT/XPath 2.0 it is possible to specify the namespace for name tests that do not have a prefix and you can do that with the xpath-default-namespace attribute. For example if you add
Code: Select all
xpath-default-namespace="https://www.Cc.org/XXX.xsd"
Best Regards,
George
George Cristian Bina
-
- Posts: 14
- Joined: Mon Feb 09, 2009 5:49 pm
Re: XPATH/XSLT Trouble with Complex Schema
That did it, thanks!
I've been a software developer for 20+ years but getting my head around the XML world has been an incredible challenge. Thanks for helping a noob out!
I've been a software developer for 20+ years but getting my head around the XML world has been an incredible challenge. Thanks for helping a noob out!
george wrote:Look at XPath default namespace.
In XSLT/XPath 1.0 all the name tests (like the XXX name test from your template match) without a prefix will match that name from no namespace. In XSLT/XPath 2.0 it is possible to specify the namespace for name tests that do not have a prefix and you can do that with the xpath-default-namespace attribute. For example if you add
on the xsl:stylesheet element from both your XSLT files then you will get the behavior you expect, that is the template matching on XXX wil match the root element of your document.Code: Select all
xpath-default-namespace="https://www.Cc.org/XXX.xsd"
Best Regards,
George
-
- Posts: 14
- Joined: Mon Feb 09, 2009 5:49 pm
Re: XPATH/XSLT Trouble with Complex Schema
Without the default namespace, but with a namespace defined in the template,
should auto-complete be able to offer suggestions for that namespace in the match?
Code: Select all
xmlns:sdr="https://www.Cc.org/XXX.xsd"
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service