AirScan / eSCL protocol input source change from Platen to ADF for Xerox WorkCentre 3345 - scanning

I have a Xerox WorkCentre 3345 multifunctional printer/scanner. I claims that it supports eSCL protocol for driverless scanning. I can scan with it to the input source called 'Platen'. The problem is no matter how I try it does not scan from the 'ADF' input source.
What XML do I need to send to be able to scan from ADF?
The ScannerCapabilities file is the following:
<?xml version="1.0" encoding="UTF-8"?>
<scan:ScannerCapabilities xmlns:pwg="http://www.pwg.org/schemas/2010/12/sm" xmlns:scan="http://schemas.hp.com/imaging/escl/2011/05/03">
<pwg:Version>2.5</pwg:Version>
<pwg:MakeAndModel>WorkCentre 3345</pwg:MakeAndModel>
<pwg:SerialNumber>3387495346</pwg:SerialNumber>
<scan:Platen>
<scan:PlatenInputCaps>
<scan:MinWidth>1</scan:MinWidth>
<scan:MaxWidth>2560</scan:MaxWidth>
<scan:MinHeight>1</scan:MinHeight>
<scan:MaxHeight>3507</scan:MaxHeight>
<scan:SettingProfiles>
<scan:SettingProfile>
<scan:ColorModes>
<scan:ColorMode>BlackAndWhite1</scan:ColorMode>
<scan:ColorMode>Grayscale8</scan:ColorMode>
<scan:ColorMode>RGB24</scan:ColorMode>
</scan:ColorModes>
<scan:DocumentFormats>
<pwg:DocumentFormat>application/pdf</pwg:DocumentFormat>
<scan:DocumentFormatExt>application/pdf</scan:DocumentFormatExt>
<pwg:DocumentFormat>image/jpeg</pwg:DocumentFormat>
<scan:DocumentFormatExt>image/jpeg</scan:DocumentFormatExt>
</scan:DocumentFormats>
<scan:SupportedResolutions>
<scan:DiscreteResolutions>
<scan:DiscreteResolution>
<scan:XResolution>100</scan:XResolution>
<scan:YResolution>100</scan:YResolution>
</scan:DiscreteResolution>
<scan:DiscreteResolution>
<scan:XResolution>200</scan:XResolution>
<scan:YResolution>200</scan:YResolution>
</scan:DiscreteResolution>
<scan:DiscreteResolution>
<scan:XResolution>300</scan:XResolution>
<scan:YResolution>300</scan:YResolution>
</scan:DiscreteResolution>
<scan:DiscreteResolution>
<scan:XResolution>600</scan:XResolution>
<scan:YResolution>600</scan:YResolution>
</scan:DiscreteResolution>
</scan:DiscreteResolutions>
</scan:SupportedResolutions>
</scan:SettingProfile>
</scan:SettingProfiles>
<scan:SupportedIntents>
<scan:Intent>Document</scan:Intent>
<scan:Intent>TextAndGraphic</scan:Intent>
<scan:Intent>Photo</scan:Intent>
</scan:SupportedIntents>
<scan:MaxOpticalXResolution>600</scan:MaxOpticalXResolution>
<scan:MaxOpticalYResolution>600</scan:MaxOpticalYResolution>
</scan:PlatenInputCaps>
</scan:Platen>
<scan:Adf>
<scan:AdfSimplexInputCaps>
<scan:MinWidth>1</scan:MinWidth>
<scan:MaxWidth>5120</scan:MaxWidth>
<scan:MinHeight>1</scan:MinHeight>
<scan:MaxHeight>4200</scan:MaxHeight>
<scan:SettingProfiles>
<scan:SettingProfile>
<scan:ColorModes>
<scan:ColorMode>BlackAndWhite1</scan:ColorMode>
<scan:ColorMode>Grayscale8</scan:ColorMode>
<scan:ColorMode>RGB24</scan:ColorMode>
</scan:ColorModes>
<scan:DocumentFormats>
<pwg:DocumentFormat>application/pdf</pwg:DocumentFormat>
<scan:DocumentFormatExt>application/pdf</scan:DocumentFormatExt>
<pwg:DocumentFormat>image/jpeg</pwg:DocumentFormat>
<scan:DocumentFormatExt>image/jpeg</scan:DocumentFormatExt>
</scan:DocumentFormats>
<scan:SupportedResolutions>
<scan:DiscreteResolutions>
<scan:DiscreteResolution>
<scan:XResolution>100</scan:XResolution>
<scan:YResolution>100</scan:YResolution>
</scan:DiscreteResolution>
<scan:DiscreteResolution>
<scan:XResolution>200</scan:XResolution>
<scan:YResolution>200</scan:YResolution>
</scan:DiscreteResolution>
<scan:DiscreteResolution>
<scan:XResolution>300</scan:XResolution>
<scan:YResolution>300</scan:YResolution>
</scan:DiscreteResolution>
<scan:DiscreteResolution>
<scan:XResolution>600</scan:XResolution>
<scan:YResolution>600</scan:YResolution>
</scan:DiscreteResolution>
</scan:DiscreteResolutions>
</scan:SupportedResolutions>
</scan:SettingProfile>
</scan:SettingProfiles>
<scan:SupportedIntents>
<scan:Intent>Document</scan:Intent>
<scan:Intent>TextAndGraphic</scan:Intent>
<scan:Intent>Photo</scan:Intent>
</scan:SupportedIntents>
<scan:MaxOpticalXResolution>600</scan:MaxOpticalXResolution>
<scan:MaxOpticalYResolution>600</scan:MaxOpticalYResolution>
</scan:AdfSimplexInputCaps>
<scan:FeederCapacity>100</scan:FeederCapacity>
<scan:AdfOptions>
<scan:AdfOption>DetectPaperLoaded</scan:AdfOption>
</scan:AdfOptions>
</scan:Adf>
</scan:ScannerCapabilities>
I can scan with the following XML to Platen:
<?xml version="1.0" encoding="UTF-8"?>
<scan:ScanSettings xmlns:pwg="http://www.pwg.org/schemas/2010/12/sm"
xmlns:scan="http://schemas.hp.com/imaging/escl/2011/05/03">
<pwg:Version>2.5</pwg:Version>
<pwg:ScanRegions>
<pwg:ScanRegion>
<pwg:Height>3507</pwg:Height>
<pwg:Width>2560</pwg:Width>
<pwg:XOffset>0</pwg:XOffset>
<pwg:YOffset>0</pwg:YOffset>
</pwg:ScanRegion>
</pwg:ScanRegions>
<pwg:InputSource>Platen</pwg:InputSource> <!-- Changing this line to Adf or AdfSimplex does not help!-->
<scan:ColorMode>Grayscale8</scan:ColorMode>
<scan:XResolution>600</scan:XResolution>
<scan:YResolution>600</scan:YResolution>
<pwg:DocumentFormat>application/pdf</pwg:DocumentFormat>
<scan:Intent>Document</scan:Intent>
</scan:ScanSettings>

Try the following line:
<pwg:InputSource>Feeder</pwg:InputSource>

Related

getLegendGraphic in Geoserver does not display title

When a SLD have a dynamic fill color or dynamic stroke color, then the title is not displayed in the Legend when a legend is requested from Geoserver.
See example below:
<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:se="http://www.opengis.net/se" xmlns:ogc="http://www.opengis.net/ogc" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<NamedLayer>
<se:Name>prop_land_use</se:Name>
<UserStyle>
<se:Name>prop_land_use</se:Name>
<se:FeatureTypeStyle>
<se:Rule>
<se:Name>default</se:Name>
<se:Description>
<se:Title>Property Land Use</se:Title>
</se:Description>
<se:MinScaleDenominator>0.0</se:MinScaleDenominator>
<se:MaxScaleDenominator>300000.0</se:MaxScaleDenominator>
<se:PolygonSymbolizer uom="http://www.opengeospatial.org/se/units/metre">
<se:Fill>
<se:SvgParameter name="fill">
<ogc:PropertyName>lnduse_clr</ogc:PropertyName>
</se:SvgParameter>
<se:SvgParameter name="fill-opacity">0.1</se:SvgParameter>
</se:Fill>
<se:Stroke>
<se:SvgParameter name="stroke">
<ogc:PropertyName>lnduse_clr</ogc:PropertyName>
</se:SvgParameter>
<se:SvgParameter name="stroke-width">0.2</se:SvgParameter>
<se:SvgParameter name="stroke-linecap">
<ogc:Literal>round</ogc:Literal>
</se:SvgParameter>
<se:SvgParameter name="stroke-linejoin">
<ogc:Literal>round</ogc:Literal>
</se:SvgParameter>
</se:Stroke>
</se:PolygonSymbolizer>
</se:Rule>
</se:FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>

Getting parent index in map iteration

My task is to 'flatten' a 3 level structure into a 2 level structure.
I am iterating the 3 level structure in XML and I am mapping 'Level3' fields to 'Level2' and this is working just fine, but I also need the index of 'Level2' in one of the 'Level3' mappings.
So my problem is "getting the Level2.index() while iterating Level3".
Hope you can help :-)
XML structure (IN):
-----------------------
<?xml version="1.0" encoding="UTF-8"?>
<ns:Level1 xmlns:ns="urn:aaaa:bbbb:cccc">
<Level2>
<Level3>
</Level3>
<Level3>
</Level3>
</Level2>
<Level2>
<Level3>
</Level3>
<Level3>
</Level3>
</Level2>
</ns:Level1>
XML structure (OUT):
-----------------------
<?xml version="1.0" encoding="UTF-8"?>
<ns:Level1 xmlns:ns="urn:aaaa:bbbb:cccc">
<Level2>
</Level2>
<Level2>
</Level2>
<Level2>
</Level2>
<Level2>
</Level2>
</ns:Level1>
Dataweave 2.0 Code:
-----------------------
(payload.ns0#Level1.*Level2.*Level3 map ( level3 , indexOfLevel3 ) -> {
Level3Index: payload.ns0#Level1.*Level2.index()?? "",
})
The simples way is to nest to maps and flatten them using the object expansion feature. Dynamic Elements Doc
%dw 2.0
output application/xml
---
Level1: {
( //Flatten all Level2
payload.Level1.*Level2 map ((item, level2Index) ->
{
(//Flatten all the level 3 under level2
item.*Level3 map ((item, level3Index) -> {
Level3: level2Index
})
)
}
)
)
}

XSLT Outer Bracket Node Inside Inner Bracket

I have the following XML:
<Root>
<PersonSettings>
<Type Drinks="1">A</Type>
<Type Drinks="2">B</Type>
<Type Drinks="3">C</Type>
<LowestAge>20</LowestAge>
<MaxAge>49</MaxAge>
</PersonSettings>
<PersonSettings>
<Type Drinks="5">A</Type>
<Type Drinks="8">B</Type>
<Type Drinks="1">C</Type>
<LowestAge>50</LowestAge>
<MaxAge>90</MaxAge>
</PersonSettings>
<Person Alive="Yes">
<Type>A</Type>
<Age>23</Age>
</Person>
<Person Alive="Yes">
<Type>B</Type>
<Age>50</Age>
</Person>
<Person Alive="Yes">
<Type>C</Type>
<Age>51</Age>
</Person>
<Person Alive="Yes">
<Type>A</Type>
<Age>70</Age>
</Person>
</Root>
And the following XSLT:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="utf-8" indent="no"/>
<xsl:template match="/">
<PersonsOneDrink>
<xsl:value-of select="(count(/Root/Person[#Alive = 'Yes' and /Root/PersonSettings[**(Person/Age)** >= LowestAge and **(Person/Age)** <= MaxAge]/Type[. = **(Person/Type)** and #Drinks = '1']))"/>
</PersonsOneDrink>
</xsl:template>
</xsl:stylesheet>
What I want to do in this example is count the number of people with one drink, that are alive. I have different settings depending on the Type of Person and the Age of such person. For example Type A has one drink if between 20 and 49 years of age, while type C has one drink if between 50 to 90 years. The problem I find is that I cannot reference the outer node when going inside a second set of brackets. Is there any way to create a variable on the fly?
P.S: The parts with * * () * * are where I would like to reference the outer node.
I don't think this can be done with a single count() expression, applied from the context of the root.
The problem here is that you need to refer to the values of Person within the predicate comparing them to the values of the prospective PersonSettings. For this, you need to use the current() function - but in order to have the current() function refer to Person, you must first make Person the context node.
Here is a suggested approach that writes a character for each Person that passes the test into a variable. This eliminates the need to convert the variable into a node-set before counting it:
XSLT 1.0
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/Root">
<xsl:variable name="v1">
<xsl:for-each select="Person">
<xsl:if test="#Alive = 'Yes' and /Root/PersonSettings[LowestAge <= current()/Age and MaxAge >= current()/Age]/Type[. = current()/Type]/#Drinks = 1">
<xsl:text>Y</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<PersonsOneDrink>
<xsl:value-of select="string-length($v1)"/>
</PersonsOneDrink>
</xsl:template>
</xsl:stylesheet>
Result
<?xml version="1.0" encoding="UTF-8"?>
<PersonsOneDrink>2</PersonsOneDrink>
A more general solution - suitable if you want to perform several queries on the supplied data - would start by rewriting the input and assigning each Person the corresponding amount of drinks .
Here we will construct a variable that contains:
<Person>
<Type>A</Type>
<Age>23</Age>
<Drinks>1</Drinks>
</Person>
<Person>
<Type>B</Type>
<Age>50</Age>
<Drinks>8</Drinks>
</Person>
<Person>
<Type>C</Type>
<Age>51</Age>
<Drinks>1</Drinks>
</Person>
<Person>
<Type>A</Type>
<Age>70</Age>
<Drinks>5</Drinks>
</Person>
Then, once the variable is converted into a node-set, it is trivial to get the number of persons with any amount of drinks:
XSLT 1.0
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
extension-element-prefixes="exsl">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/Root">
<!-- first pass -->
<xsl:variable name="persons-rtf">
<xsl:for-each select="Person">
<xsl:copy>
<xsl:copy-of select="*"/>
<Drinks>
<xsl:value-of select="/Root/PersonSettings[LowestAge <= current()/Age and MaxAge >= current()/Age]/Type[. = current()/Type]/#Drinks"/>
</Drinks>
</xsl:copy>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="persons" select="exsl:node-set($persons-rtf)/Person"/>
<!-- output -->
<results>
<PersonsOneDrink>
<xsl:value-of select="count($persons[Drinks = 1])"/>
</PersonsOneDrink>
</results>
</xsl:template>
</xsl:stylesheet>

xslt from two xml files using a matching node value

Kindly help me with the below expected output.I tried doing using for-each etc but ParentUUID1 is getting repeated for all RECORDS. I need to match the subscription_id key attribute from File2.xml with that in MainInput.xml and get the final expected output.
MainInput.xml
<?xml version="1.0" encoding="UTF-8" ?>
<qw:ACCOUNT_CHANGES xmlns:qw="http://xmlns.dummy.com/qwSubsResponse">
<qw:RECORD>
<qw:SUBSCRIPTION>
<qw:INFO key="subscriptionid_hash">abcd</qw:INFO>
<qw:INFO key="subscription_id">140172</qw:INFO>
<qw:INFO key="uuid">ParentUUID1</qw:INFO>
</qw:SUBSCRIPTION>
<qw:ALL_FO_ACCOUNTS>
<qw:FO_ACCOUNT>
<qw:FODATA key="subscription_id">140172</qw:FODATA>
<qw:FODATA key="uuid">uuidfouser1</qw:FODATA>
</qw:FO_ACCOUNT>
<qw:FO_ACCOUNT>
<qw:FODATA key="subscription_id">140172</qw:FODATA>
<qw:FODATA key="uuid">uuidfouser1</qw:FODATA>
</qw:FO_ACCOUNT>
</qw:ALL_FO_ACCOUNTS>
<qw:Platform>plat1</qw:Platform>
<qw:skip_subscription>1</qw:skip_subscription>
</qw:RECORD>
<qw:RECORD>
<qw:SUBSCRIPTION>
<qw:INFO key="subscriptionid_hash">xyz</qw:INFO>
<qw:INFO key="subscription_id">140</qw:INFO>
<qw:INFO key="uuid">ParentUUID2</qw:INFO>
</qw:SUBSCRIPTION>
<qw:ALL_FO_ACCOUNTS>
<qw:FO_ACCOUNT>
<qw:FODATA key="subscription_id">140</qw:FODATA>
<qw:FODATA key="uuid">uuidrcd2</qw:FODATA>
</qw:FO_ACCOUNT>
</qw:ALL_FO_ACCOUNTS>
<qw:Platform>plat1</qw:Platform>
<qw:skip_subscription>1</qw:skip_subscription>
</qw:RECORD>
</qw:ACCOUNT_CHANGES>
File2.xml
<?xml version="1.0" encoding="UTF-8" ?>
<qw:ACCOUNT_CHANGES xmlns:qw="http://xmlns.dummy.com/qwSubsResponse">
<qw:RECORD>
<qw:ALL_FO_ACCOUNTS>
<qw:FO_ACCOUNT>
<qw:FODATA key="subscription_id">140172</qw:FODATA>
<qw:FODATA key="uuid">uuidfouser1</qw:FODATA>
</qw:FO_ACCOUNT>
<qw:FO_ACCOUNT>
<qw:FODATA key="subscription_id">140172</qw:FODATA>
<qw:FODATA key="uuid">uuidfouser1</qw:FODATA>
</qw:FO_ACCOUNT>
</qw:ALL_FO_ACCOUNTS>
<qw:Platform>plat1</qw:Platform>
<qw:skip_subscription>1</qw:skip_subscription>
</qw:RECORD>
<qw:RECORD>
<qw:ALL_FO_ACCOUNTS>
<qw:FO_ACCOUNT>
<qw:FODATA key="subscription_id">140</qw:FODATA>
<qw:FODATA key="uuid">uuidrcd2</qw:FODATA>
</qw:FO_ACCOUNT>
</qw:ALL_FO_ACCOUNTS>
<qw:Platform>plat1</qw:Platform>
<qw:skip_subscription>1</qw:skip_subscription>
</qw:RECORD>
</qw:ACCOUNT_CHANGES>
Expected output:
<?xml version = '1.0' encoding = 'UTF-8'?>
<ns1:ACCOUNT_CHANGES xmlns:ns1="http://xmlns.dummy.com/qwSubsResponse">
<ns1:RECORD>
<ns1:SUBSCRIPTION>
<ns1:INFO key="uuid">ParentUUID1</qw:INFO>
</ns1:SUBSCRIPTION>
<ns1:ALL_FO_ACCOUNTS>
<ns1:FO_ACCOUNT>
<ns1:FODATA key="subscription_id">140172</ns1:FODATA>
<ns1:FODATA key="uuid">uuidfouser1</ns1:FODATA>
</ns1:FO_ACCOUNT>
<ns1:FO_ACCOUNT>
<ns1:FODATA key="subscription_id">140172</ns1:FODATA>
<ns1:FODATA key="uuid">uuidfouser1</ns1:FODATA>
</ns1:FO_ACCOUNT>
</ns1:ALL_FO_ACCOUNTS>
</ns1:RECORD>
<ns1:RECORD>
<ns1:SUBSCRIPTION>
<ns1:INFO key="uuid">ParentUUID2</qw:INFO>
</ns1:SUBSCRIPTION>
<ns1:ALL_FO_ACCOUNTS>
<ns1:FO_ACCOUNT>
<ns1:FODATA key="subscription_id">140</ns1:FODATA>
<ns1:FODATA key="uuid">uuidrcd2</ns1:FODATA>
</ns1:FO_ACCOUNT>
</ns1:ALL_FO_ACCOUNTS>
</ns1:RECORD>
</ns1:ACCOUNT_CHANGES>

Need to group xsl:for-each-group with Muenchian method

I am not able to retrieve unique list by applying Muenchian method. I am trying to group based on "Series Title" attribute
Sample Input XML:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Distribution>
<ManifestHeader>
<Assets>
<Asset>
<ID>23341528</ID>
<CreateDate>2008-01-14T17:02:01Z</CreateDate>
<MetaDatas>
<MetaData Name="psa.orig.source.showTitle">Green Home 2008</MetaData>
<MetaData Name="displayRunTime">00:01</MetaData>
<MetaData Name="Series Title">Desperate Landscapes</MetaData>
</MetaDatas>
</Asset>
<Asset>
<ID>23341529</ID>
<CreateDate>2010-08-23T15:44:58Z</CreateDate>
<MetaDatas>
<MetaData Name="psa.orig.source.showTitle">Urban Oasis 2010</MetaData>
<MetaData Name="displayRunTime">00:02</MetaData>
<MetaData Name="Series Title">Toy Hunter</MetaData>
</MetaDatas>
</Asset>
<Asset>
<ID>23377202</ID>
<CreateDate>2007-05-18T07:40:25Z</CreateDate>
<MetaDatas>
<MetaData Name="webSeries"/>
<MetaData Name="psa.orig.source.showTitle">Cool Tools</MetaData>
<MetaData Name="displayRunTime">00:20</MetaData>
<MetaData Name="Series Title">Desperate Landscapes</MetaData>
</MetaDatas>
</Asset>
</Assets>
</ManifestHeader>
</Distribution>
XLST:
<xsl:key name="keySeriesName" match="MetaData[#Name='Series Title']" use="text()" />
<xsl:for-each select="MetaData[#Name='Series Title'][generate-id() =
generate-id(key('keySeriesName', text())[1])]">
also tried:
<xsl:for-each select="MetaData[#Name='Series Title'][count(. | key('keySeriesName',text())[1]) = 1]">
anyhelp would be appreciated
Thanks in advance
Since the <MetaData> elements are children of <MetaData> and you are trying to search across the entire collection of them within the document, you are going to need to adjust your XPath to ensure that you are addressing all of them:
/Distribution/ManifestHeader/Assets/Asset/MetaDatas/MetaData
[#Name='Series Title'][generate-id() =
generate-id(key('keySeriesName', text())[1])]
or you could use the shorter, but less efficient:
//MetaData[#Name='Series Title'][generate-id() =
generate-id(key('keySeriesName', text())[1])]