How do I display an Number attribute?
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 62
- Joined: Thu Jun 26, 2014 9:00 pm
How do I display an Number attribute?
I have a xml document that I would like to display Number attribute from <CrossReferenceNumber> element In my xslt the Number is inside <ext:SupersededProtectionOrderID> element.
Xml document can have <Type Op="A" Word="SBJO">Signed By Judicial Officer</Type>
or
<Type Op="A" Word="SBJO">Signed By Judicial Officer – Corrected’</Type>
Here are the conditions:
Condition one
If ProtectionOrder/CrossReferenceNumbers/CrossReferenceNumber/Type = ‘OFP System Number’
and
display
in the element in xslt.
Condition two
If
and
and has
display
in xsl's ext:SupersededProtectionOrderID element.
Desired output
My xml
My xslt code
Xml document can have <Type Op="A" Word="SBJO">Signed By Judicial Officer</Type>
or
<Type Op="A" Word="SBJO">Signed By Judicial Officer – Corrected’</Type>
Here are the conditions:
Condition one
If ProtectionOrder/CrossReferenceNumbers/CrossReferenceNumber/Type = ‘OFP System Number’
and
Code: Select all
ProtectionOrders/ProtectionOrder/Statuses/Status/Type = Signed By Judicial Officer has an Op = “A”
Code: Select all
ProtectionOrder/CrossReferenceNumbers/CrossReferenceNumber/Number
Code: Select all
ext:SupersededProtectionOrderID
Condition two
If
Code: Select all
ProtectionOrder/CrossReferenceNumbers/CrossReferenceNumber/Type = ‘OFP System Number’
Code: Select all
ProtectionOrders/ProtectionOrder/Statuses/Status/Type = ‘Signed By Judicial Officer – Corrected’
Code: Select all
Op = ‘A’
Code: Select all
ProtectionOrder/CrossReferenceNumbers/CrossReferenceNumber/Number
Desired output
Code: Select all
<ext:SupersededProtectionOrderID>OFP System Number</ext:SupersededProtectionOrderID>
Code: Select all
<Integration xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:tsg="http://tsgweb.com" xmlns:IXML="http://tsgweb.com" xmlns:CMCodeQueryHelper="urn:CMCodeQueryHelper" PackageID="BCA PO Notification" MessageID="67177928" xmlns="">
<ProtectionOrders>
<ProtectionOrder Op="E" InternalProtectionOrderID="932">
<ProtectionOrderNumber>201500845</ProtectionOrderNumber>
<Type Word="OFP">Order for Protection</Type>
<Statuses>
<Status Op="A">
<Current>true</Current>
<Active>Yes</Active>
<Date Op="A">09/01/2015</Date>
<Type Op="A" Word="SBJO">Signed By Judicial Officer</Type>
<TimestampCreate Op="A">09/01/2015 12:39:49:763</TimestampCreate>
</Status>
<Status>
<Current>false</Current>
<Active>No</Active>
<Date>09/01/2015</Date>
<Type Word="DRAFT">Draft</Type>
<TimestampCreate>09/01/2015 12:39:43:207</TimestampCreate>
</Status>
</Statuses>
<CrossReferenceNumbers>
<CrossReferenceNumber>
<Type Word="NCICNUM">NCIC Number</Type>
<Number>Testing123</Number>
</CrossReferenceNumber>
</CrossReferenceNumbers>
<TimestampCreate>09/01/2015 12:39:43:140</TimestampCreate>
<TimestampChange>09/01/2015 12:39:49:750</TimestampChange>
</ProtectionOrder>
</ProtectionOrders>
</Case>
<ProtectionOrder Op="E" InternalProtectionOrderID="932" xmlns:user="http://tylertechnologies.com">
<ProtectionOrderNumber>201500845</ProtectionOrderNumber>
<Type Word="OFP">Order for Protection</Type>
<Statuses>
<Status Op="A">
<Current>true</Current>
<Active>Yes</Active>
<Date Op="A">09/01/2015</Date>
<Type Op="A" Word="SBJO">Signed By Judicial Officer</Type>
<TimestampCreate Op="A">09/01/2015 12:39:49:763</TimestampCreate>
</Status>
<Status>
<Current>false</Current>
<Active>No</Active>
<Date>09/01/2015</Date>
<Type Word="DRAFT">Draft</Type>
<TimestampCreate>09/01/2015 12:39:43:207</TimestampCreate>
</Status>
</Statuses>
<CrossReferenceNumbers>
<CrossReferenceNumber>
<Type Word="NCICNUM">OFP System Number</Type>
<Number>Testing123</Number>
</CrossReferenceNumber>
</CrossReferenceNumbers>
</ProtectionOrder>
</Integration>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:exc="http://www.courts.state.mn.us/ProtectionOrderServiceExchange/1.0" xmlns:ext="http://www.courts.state.mn.us/ProtectionOrderExtension/1.0">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template name="ProtectionOrder">
<!--SupersededProtectionOrderID-->
<ext:SupersededProtectionOrderID>
<xsl:choose>
<xsl:when test="(Statuses/Status/Type/@Op='A') and count(CrossReferenceNumbers/CrossReferenceNumber/Type='OFP System Number')>0">
<xsl:value-of select="Number"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="/Integration/ProtectionOrder[@InternalProtectionOrderID=current()/MNProtectionOrderAdditional/@SupersededProtectionOrderID]/ProtectionOrderNumber"/>
</xsl:otherwise>
</xsl:choose>
</ext:SupersededProtectionOrderID>
</xsl:template>
</xsl:stylesheet>[Codebox=][/Codebox][Codebox=xml file=Untitled.xml][/Codebox]
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