[
https://issues.apache.org/jira/browse/XALANJ-2766?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mukul Gandhi resolved XALANJ-2766.
----------------------------------
Resolution: Fixed
I'm resolving this jira issue as fixed. The implementation of this jira issue
has been committed to xalan-j xsl3 dev repos branch.
> xsl transformation having access to XML Schema user-defined complex types
> -------------------------------------------------------------------------
>
> Key: XALANJ-2766
> URL: https://issues.apache.org/jira/browse/XALANJ-2766
> Project: XalanJ2
> Issue Type: New Feature
> Security Level: No security risk; visible to anyone(Ordinary problems in
> Xalan projects. Anybody can view the issue.)
> Components: Xalan-interpretive, XPath
> Reporter: Mukul Gandhi
> Assignee: Mukul Gandhi
> Priority: Major
>
> I'm creating this jira issue to track implementation of this new feature
> within Xalan-J's XSLT 3 dev branch.
> The following shall be implemented within Xalan-J, as part of this jira issue.
> XML input document:
> <?xml version="1.0" encoding="UTF-8"?>
> <info>
> <address>
> <fName>abc 1</fName>
> <lName>mno 1</lName>
> <addressLine1>address location details 1</addressLine1>
> <city>hello 1</city>
> <country>USA</country>
> <state>state 1</state>
> <zip>zip 1</zip>
> </address>
> <address>
> <fName>abc 2</fName>
> <lName>mno 2</lName>
> <addressLine1>address location details 2</addressLine1>
> <city>hello 2</city>
> <country>USA</country>
> <state>state 2</state>
> <zip>zip 2</zip>
> </address>
> <address>
> <fName>abc 3</fName>
> <lName>mno 3</lName>
> <addressLine1>address location details 2</addressLine1>
> <city>hello 3</city>
> <country>Singapore</country>
> </address>
> </info>
> XSL transformation document:
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:fn0="http://ns0"
> exclude-result-prefixes="fn0"
> version="3.0">
> <xsl:output method="xml" indent="yes"/>
>
> <xsl:import-schema schema-location="address.xsd"/>
> <xsl:template match="/info">
> <result>
> <xsl:for-each select="address">
> <xsl:variable name="addressElem" select="."/>
> <address id="{'id_' || position()}">
> <xsl:variable name="person1" as="element(*, Person)">
> <xsl:copy-of select="fn0:getAddressInfo($addressElem
> cast as Address)"/>
> </xsl:variable>
> <xsl:copy-of select="$person1"/>
> </address>
> </xsl:for-each>
> </result>
> </xsl:template>
>
> <xsl:function name="fn0:getAddressInfo" as="element(*, Person)">
> <xsl:param name="addressElem" as="element(*, Address)"/>
> <person>
> <xsl:copy-of select="$addressElem/fName | $addressElem/mName |
> $addressElem/lName"/>
> </person>
> </xsl:function>
> </xsl:stylesheet>
> The above mentioned XSL transformation document, refers to an XML Schema
> document address.xsd (via XSL instruction xsl:import-schema) that provides
> definitions of few XML Schema user-defined types as following:
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> <xs:complexType name="Address">
> <xs:sequence>
> <xs:element name="fName" type="xs:string"/>
> <xs:element name="mName" type="xs:string" minOccurs="0"/>
> <xs:element name="lName" type="xs:string"/>
> <xs:element name="addressLine1" type="xs:string"/>
> <xs:element name="addressLine2" type="xs:string"
> minOccurs="0"/>
> <xs:element name="city" type="xs:string" minOccurs="0"/>
> <xs:element name="country" type="xs:string"/>
> <xs:element name="state" type="xs:string" minOccurs="0"/>
> <xs:element name="zip" type="xs:string" minOccurs="0"/>
> </xs:sequence>
> </xs:complexType>
>
> <xs:complexType name="Person">
> <xs:sequence>
> <xs:element name="fName" type="xs:string"/>
> <xs:element name="mName" type="xs:string" minOccurs="0"/>
> <xs:element name="lName" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> </xs:schema>
> As specified above within this jira issue, when an XML input document shall
> be transformed by an XSL transformation a normal transformation output will
> be produced, but XSL transformation shall ensure type checking with
> user-defined schema types of the XML input nodes. The XSL transformation
> shall fail with type check errors, if XML input nodes don't conform with the
> specified schema types.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]