-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathST96.xsl
274 lines (249 loc) · 14.2 KB
/
ST96.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
<?xml version="1.0" encoding="utf-8"?>
<!--
Plumage: XSLT to transform USPTO TSDR XML to CSV format
https://github.com/codingatty/Plumage
ST96.xsl - ST.96 transform
Version 1.4.0 2021-02-02
Copyright 2014-2021 Terry Carroll
carroll@tjc.com
This program is licensed under Apache License, version 2.0 (January 2004),
http://www.apache.org/licenses/LICENSE-2.0
SPX-License-Identifier: Apache-2.0
Anyone who makes use of, or who modifies, this code is encouraged
(but not required) to notify the author.
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns1="http://www.wipo.int/standards/XMLSchema/ST96/Common" xmlns:ns2="http://www.wipo.int/standards/XMLSchema/ST96/Trademark" xmlns:ns3="urn:us:gov:doc:uspto:trademark">
<xsl:output method="text" encoding="utf-8" />
<xsl:variable name='NL'><xsl:text> </xsl:text></xsl:variable><!-- NL = newline character X'0A' -->
<xsl:template match="ns2:TrademarkTransaction">
<xsl:apply-templates select=".//ns2:TrademarkBag/ns2:Trademark"/>
<xsl:text/>MetaInfoXSLTName,"Plumage"
MetaInfoXSLTVersion,"1.4.0"
MetaInfoXSLTDate,"2021-02-02"
MetaInfoXSLTAuthor,"Terry Carroll"
MetaInfoXSLTURL,"https://github.com/codingatty/Plumage"
MetaInfoXSLTCopyright,"Copyright 2014-2021 Terry Carroll"
MetaInfoXSLTLicense,"Apache License, version 2.0 (January 2004)"
MetaInfoXSLTSPDXLicenseIdentifier,"Apache-2.0"
MetaInfoXSLTLicenseURL,"http://www.apache.org/licenses/LICENSE-2.0"
MetaInfoLibraryName,"$IMPLEMENTATIONNAME$"
MetaInfoLibraryVersion,"$IMPLEMENTATIONVERSION$"
MetaInfoLibraryDate,"$IMPLEMENTATIONDATE$"
MetaInfoLibraryAuthor,"$IMPLEMENTATIONAUTHOR$"
MetaInfoLibraryURL,"$IMPLEMENTATIONURL$"
MetaInfoLibraryCopyright,"$IMPLEMENTATIONCOPYRIGHT$"
MetaInfoLibraryLicense,"$IMPLEMENTATIONLICENSE$"
MetaInfoLibrarySPDXLicenseIdentifier,"$IMPLEMENTATIONSPDXLID$"
MetaInfoLibraryLicenseURL,"$IMPLEMENTATIONLICENSEURL$"
MetaInfoExecXSLTFilename,"$XSLTFILENAME$"
MetaInfoExecXSLTLocation,"$XSLTLOCATION$"
MetaInfoExecXSLTFormat,"ST.96"
MetaInfoExecExecutionDateTime,"$EXECUTIONDATETIME$"
MetaInfoExecTSDRStartTimestamp,"$TSDRSTARTDATETIME$"
MetaInfoExecTSDRCompleteTimestamp,"$TSDRCOMPLETEDATETIME$"
MetaInfoExecXMLSource,"$XMLSOURCE$"
MetaInfoExecEnvironment,"$MetaInfoExecEnvironment$"
MetaInfoExecXSLProcessorVersion,"<xsl:value-of select="system-property('xsl:version')"/>"
MetaInfoExecXSLProcessorVendor,"<xsl:value-of select="system-property('xsl:vendor')"/>"
MetaInfoExecXSLProcessorVendorURL,"<xsl:value-of select="system-property('xsl:vendor-url')"/>"
</xsl:template>
<xsl:template match="ns2:Trademark">
<xsl:text/>MarkCurrentStatusDate,"<xsl:value-of select="ns2:MarkCurrentStatusDate"/>"
MarkCurrentStatusDateTruncated,"<xsl:value-of select="substring(ns2:MarkCurrentStatusDate,1,10)"/>"
ApplicationNumber,"<xsl:value-of select="ns1:ApplicationNumber/ns1:ApplicationNumberText"/>"
ApplicationDate,"<xsl:value-of select="ns2:ApplicationDate"/>"
ApplicationDateTruncated,"<xsl:value-of select="substring(ns2:ApplicationDate,1,10)"/>"
RegistrationNumber,"<xsl:value-of select="ns1:RegistrationNumber"/>"
RegistrationDate,"<xsl:value-of select="ns1:RegistrationDate"/>"
RegistrationDateTruncated,"<xsl:value-of select="substring(ns1:RegistrationDate,1,10)"/>"
<xsl:apply-templates select="ns2:MarkRepresentation/ns2:MarkReproduction/ns2:WordMarkSpecification"/>
<xsl:apply-templates select="ns2:NationalTrademarkInformation"/>
<xsl:apply-templates select="ns2:AssociatedMarkBag/ns2:AssociatedMark"/>
<xsl:apply-templates select="ns2:GoodsServicesBag/ns2:GoodsServices/ns2:ClassDescriptionBag/ns2:ClassDescription"/>
<xsl:apply-templates select="ns2:GoodsServicesBag/ns2:GoodsServices/ns2:GoodsServicesClassificationBag/ns2:GoodsServicesClassification"/>
<xsl:apply-templates select="ns2:GoodsServicesBag/ns2:GoodsServices/ns2:NationalFilingBasis"/>
<xsl:apply-templates select="ns2:PublicationBag/ns2:Publication"/>
<xsl:apply-templates select="ns2:NationalCorrespondent/ns1:Contact"/>
<xsl:apply-templates select="ns1:StaffBag/ns1:Staff"/>
<xsl:apply-templates select="ns2:ApplicantBag/ns2:Applicant"/>
<xsl:apply-templates select="ns2:MarkEventBag/ns2:MarkEvent"/>
<xsl:apply-templates select="ns2:AssignmentBag/ns2:Assignment"/>
</xsl:template>
<xsl:template match="ns2:MarkRepresentation/ns2:MarkReproduction/ns2:WordMarkSpecification">
<xsl:text/>MarkVerbalElementText,"<xsl:value-of select="ns2:MarkVerbalElementText"/>"
</xsl:template>
<xsl:template match="ns2:NationalTrademarkInformation">
<xsl:text/>MarkCurrentStatusExternalDescriptionText,"<xsl:value-of select="ns2:MarkCurrentStatusExternalDescriptionText"/>"
<!-- kludge: ST.96 format uses "Primary" instead of "Principal" for the Principal Register -->
<xsl:choose>
<xsl:when test="ns2:RegisterCategory = 'Primary'">
<xsl:text/>RegisterCategory,"Principal"<xsl:text/>
</xsl:when>
<xsl:otherwise>
<xsl:text/>RegisterCategory,"<xsl:value-of select="ns2:RegisterCategory"/>"<xsl:text/>
</xsl:otherwise>
</xsl:choose>
RenewalDate,"<xsl:value-of select="ns2:RenewalDate"/>"
RenewalDateTruncated,"<xsl:value-of select="substring(ns2:RenewalDate,1,10)"/>"
<xsl:apply-templates select="ns2:NationalCaseLocation"/>
</xsl:template>
<xsl:template match="ns2:NationalCaseLocation">
<xsl:text/>LawOfficeAssignedText,"<xsl:value-of select="ns2:LawOfficeAssignedText"/>"
CurrentLocationCode,"<xsl:value-of select="ns2:CurrentLocationCode"/>"
CurrentLocationText,"<xsl:value-of select="ns2:CurrentLocationText"/>"
CurrentLocationDate,"<xsl:value-of select="ns2:CurrentLocationDate"/>"
CurrentLocationDateTruncated,"<xsl:value-of select="substring(ns2:CurrentLocationDate,1,10)"/>"
</xsl:template>
<!-- This is odd, but, yes, the *registration* number is stored under "InternationalApplicationNumber".
This is a change from ST96 1_D3 to ST96 2.2.1 -->
<xsl:template match="ns2:AssociatedMarkBag/ns2:AssociatedMark">
<xsl:if test="ns2:AssociationCategory = 'International application or registration'">
<xsl:text/>InternationalApplicationNumber,"<xsl:value-of select="ns1:ApplicationNumber/ns1:ApplicationNumberText"/>"
InternationalRegistrationNumber,"<xsl:value-of select="ns2:InternationalApplicationNumber/ns1:ApplicationNumberText"/>"
</xsl:if>
</xsl:template>
<!-- ST96 has two types of ClassDescription nodes; one with the class number and description; and one with a NationalStatusBag node. We process only the first type. -->
<xsl:template match="ns2:GoodsServicesBag/ns2:GoodsServices/ns2:ClassDescriptionBag/ns2:ClassDescription">
<xsl:if test="ns2:ClassNumber != ''">
<xsl:text/>BeginRepeatedField,"InternationalClassDescription"
InternationalClassNumber,"<xsl:value-of select="ns2:ClassNumber"/>"
GoodsServicesDescription,"<xsl:value-of select="ns2:GoodsServicesDescriptionText"/>"
EndRepeatedField,"InternationalClassDescription"
</xsl:if>
</xsl:template>
<xsl:template match="ns2:GoodsServicesBag/ns2:GoodsServices/ns2:GoodsServicesClassificationBag/ns2:GoodsServicesClassification">
<xsl:if test="ns2:ClassificationKindCode = 'Domestic'">
<xsl:text/>BeginRepeatedField,"DomesticClassDescription"
<xsl:for-each select="../ns2:GoodsServicesClassification">
<xsl:if test="ns2:ClassificationKindCode = 'Primary'">
<xsl:text/>PrimaryClassNumber,"<xsl:value-of select="ns2:ClassNumber"/>"
</xsl:if>
<xsl:if test="ns2:ClassificationKindCode = 'Nice'">
<xsl:text/>NiceClassNumber,"<xsl:value-of select="ns2:ClassNumber"/>"
</xsl:if>
</xsl:for-each>
<xsl:text/>ClassificationKindCode,"<xsl:value-of select="ns2:ClassificationKindCode"/>"
NationalClassNumber,"<xsl:value-of select="ns2:NationalClassNumber"/>"
<xsl:text/>EndRepeatedField,"DomesticClassDescription"
</xsl:if>
</xsl:template>
<xsl:template match="ns2:GoodsServicesBag/ns2:GoodsServices/ns2:NationalFilingBasis">
<xsl:text/>BeginRepeatedField,"FirstUseDate"
<xsl:for-each select="../ns2:GoodsServicesClassificationBag/ns2:GoodsServicesClassification">
<xsl:if test="ns2:ClassificationKindCode = 'Primary'">
<xsl:text/>PrimaryClassNumber,"<xsl:value-of select="ns2:ClassNumber"/>"
</xsl:if>
<xsl:if test="ns2:ClassificationKindCode = 'Nice'">
<xsl:text/>NiceClassNumber,"<xsl:value-of select="ns2:ClassNumber"/>"
</xsl:if>
</xsl:for-each>
<xsl:text/>FirstUseDateNumber,"<xsl:value-of select="ns2:FirstUsedDate"/>"
FirstUseInCommerceDate,"<xsl:value-of select="ns2:FirstUsedCommerceDate"/>"
<xsl:text/>EndRepeatedField,"FirstUseDate"
</xsl:template>
<xsl:template match="ns2:PublicationBag/ns2:Publication">
<xsl:text/>PublicationDate,"<xsl:value-of select="ns1:PublicationDate"/>"
PublicationDateTruncated,"<xsl:value-of select="substring(ns1:PublicationDate,1,10)"/>"
</xsl:template>
<xsl:template match="ns2:NationalCorrespondent/ns1:Contact">
<xsl:text/>CorrespondentName,"<xsl:value-of select="ns1:Name/ns1:PersonName/ns1:PersonFullName"/>"
CorrespondentOrganization,"<xsl:value-of select="ns1:Name/ns1:OrganizationName/ns1:OrganizationStandardName"/>"
<xsl:apply-templates select="ns1:PostalAddressBag/ns1:PostalAddress/ns1:PostalStructuredAddress" mode="CorrespondentAddress"/>
CorrespondentPhoneNumber,"<xsl:value-of select="ns1:PhoneNumberBag/ns1:PhoneNumber"/>"
CorrespondentFaxNumber,"<xsl:value-of select="ns1:FaxNumberBag/ns1:FaxNumber"/>"
CorrespondentEmailAddress,"<xsl:value-of select="ns1:EmailAddressBag/ns1:EmailAddressText"/>"
</xsl:template>
<xsl:template match="ns1:PostalAddressBag/ns1:PostalAddress/ns1:PostalStructuredAddress" mode="CorrespondentAddress">
<xsl:text/>CorrespondentAddressLine01,"<xsl:value-of select="ns1:AddressLineText[@ns1:sequenceNumber='1']"/>"
CorrespondentAddressLine02,"<xsl:value-of select="ns1:AddressLineText[@ns1:sequenceNumber='2']"/>"
CorrespondentAddressCity,"<xsl:value-of select="ns1:CityName"/>"
CorrespondentAddressGeoRegion,"<xsl:value-of select="ns1:GeographicRegionName"/>"
CorrespondentPostalCode,"<xsl:value-of select="ns1:PostalCode"/>"
CorrespondentCountryCode,"<xsl:value-of select="ns1:CountryCode"/>"<xsl:text/>
<xsl:value-of select="concat($NL, 'CorrespondentCombinedAddress,"',
ns1:AddressLineText[@ns1:sequenceNumber='1'], '/',
ns1:AddressLineText[@ns1:sequenceNumber='2'], '/',
ns1:CityName, '/',
ns1:GeographicRegionName, '/',
ns1:PostalCode, '/',
ns1:CountryCode, '"'
)"/>
</xsl:template>
<xsl:template match="ns2:ApplicantBag/ns2:Applicant">
<xsl:text/>BeginRepeatedField,"Applicant"<xsl:text/>
<xsl:choose>
<xsl:when test="ns1:Contact/ns1:Name/ns1:EntityName != ''">
ApplicantName,"<xsl:value-of select="ns1:Contact/ns1:Name/ns1:EntityName"/>"<xsl:text/>
</xsl:when>
<xsl:otherwise>
ApplicantName,"<xsl:value-of select="ns1:Contact/ns1:Name/ns1:OrganizationName/ns1:OrganizationStandardName"/>"<xsl:text/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="ns1:Version/ns1:CommentText != ''">
ApplicantDescription,"<xsl:value-of select="ns1:Version/ns1:CommentText"/>"<xsl:text/>
</xsl:when>
<xsl:otherwise>
ApplicantDescription,"<xsl:value-of select="ns1:CommentText"/>"<xsl:text/>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="ns1:Contact/ns1:PostalAddressBag/ns1:PostalAddress/ns1:PostalStructuredAddress" mode="ApplicantAddress"/>
EndRepeatedField,"Applicant"
</xsl:template>
<xsl:template match="ns1:Contact/ns1:PostalAddressBag/ns1:PostalAddress/ns1:PostalStructuredAddress" mode="ApplicantAddress">
ApplicantAddressLine01,"<xsl:value-of select="ns1:AddressLineText[@ns1:sequenceNumber='1']"/>"
ApplicantAddressLine02,"<xsl:value-of select="ns1:AddressLineText[@ns1:sequenceNumber='2']"/>"
ApplicantAddressCity,"<xsl:value-of select="ns1:CityName"/>"
ApplicantAddressGeoRegion,"<xsl:value-of select="ns1:GeographicRegionName"/>"
ApplicantPostalCode,"<xsl:value-of select="ns1:PostalCode"/>"
ApplicantCountryCode,"<xsl:value-of select="ns1:CountryCode"/>"<xsl:text/>
<xsl:value-of select="concat($NL, 'ApplicantCombinedAddress,"',
ns1:AddressLineText[@ns1:sequenceNumber='1'], '/',
ns1:AddressLineText[@ns1:sequenceNumber='2'], '/',
ns1:CityName, '/',
ns1:GeographicRegionName, '/',
ns1:PostalCode, '/',
ns1:CountryCode, '"'
)"/>
</xsl:template>
<xsl:template match="ns1:StaffBag/ns1:Staff">
<xsl:text/>StaffName,"<xsl:value-of select="ns1:StaffName"/>"
StaffOfficialTitle,"<xsl:value-of select="ns1:OfficialTitleText"/>"
</xsl:template>
<xsl:template match="ns2:MarkEventBag/ns2:MarkEvent">
<xsl:text/>BeginRepeatedField,"MarkEvent"
MarkEventDate,"<xsl:value-of select="ns2:MarkEventDate"/>"
MarkEventDateTruncated,"<xsl:value-of select="substring(ns2:MarkEventDate,1,10)"/>"
MarkEventDescription,"<xsl:value-of select="ns2:NationalMarkEvent/ns2:MarkEventDescriptionText"/>"
MarkEventEntryNumber,"<xsl:value-of select="ns2:NationalMarkEvent/ns2:MarkEventEntryNumber"/>"
EndRepeatedField,"MarkEvent"
</xsl:template>
<xsl:template match="ns2:AssignmentBag/ns2:Assignment">
<xsl:text/>BeginRepeatedField,"Assignment"
AssignmentIdentifier,"<xsl:value-of select="ns2:AssignmentIdentifier"/>"
AssignmentConveyanceCategory,"<xsl:value-of select="ns2:AssignmentConveyanceCategory"/>"
AssignmentGroupCategory,"<xsl:value-of select="ns2:AssignmentGroupCategory"/>"
AssignmentRecordedDate,"<xsl:value-of select="ns2:AssignmentRecordedDate"/>"
AssignmentRecordedDateTruncated,"<xsl:value-of select="substring(ns2:AssignmentRecordedDate,1,10)"/>"
AssignmentExecutedDate,"<xsl:value-of select="ns2:AssignmentExecutedDate"/>"
AssignmentExecutedDateTruncated,"<xsl:value-of select="substring(ns2:AssignmentExecutedDate,1,10)"/>"<xsl:text/>
<xsl:choose>
<xsl:when test="ns2:AssignorBag/ns2:Assignor/ns1:Contact/ns1:Name/ns1:EntityName != ''">
AssignorEntityName,"<xsl:value-of select="ns2:AssignorBag/ns2:Assignor/ns1:Contact/ns1:Name/ns1:EntityName"/>"<xsl:text/>
</xsl:when>
<xsl:otherwise>
AssignorEntityName,"<xsl:value-of select="ns2:AssignorBag/ns2:Assignor/ns1:Contact/ns1:Name/ns1:OrganizationName/ns1:OrganizationStandardName"/>"<xsl:text/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="ns2:AssigneeBag/ns2:Assignee/ns1:Contact/ns1:Name/ns1:EntityName != ''">
AssigneeEntityName,"<xsl:value-of select="ns2:AssigneeBag/ns2:Assignee/ns1:Contact/ns1:Name/ns1:EntityName"/>"<xsl:text/>
</xsl:when>
<xsl:otherwise>
AssigneeEntityName,"<xsl:value-of select="ns2:AssigneeBag/ns2:Assignee/ns1:Contact/ns1:Name/ns1:OrganizationName/ns1:OrganizationStandardName"/>"<xsl:text/>
</xsl:otherwise>
</xsl:choose>
AssignmentDocumentURL,"<xsl:value-of select="ns2:AssignmentDocumentBag/ns2:TrademarkDocument/ns1:DocumentIdentifier"/>"
EndRepeatedField,"Assignment"
</xsl:template>
</xsl:stylesheet>