How to process remote XML files with XSLT - xslt

I'm processing remote XML (by just providing URL to XSLT processor) and I can't make it "fetch" additional XML resources. I read similar questions here, but none of them seem like applicable here.
Here is excerpt of remote XML that is being processed:
...
<item>
<position>1</position>
<rec id="05a59ca2"/>
</item>
<item>
<position>2</position>
<rec id="48e7c3f1"/>
</item>
...
Now these id attributes can be used to refer remote XML source (http://some-server/id) where additional details about each record is stored, and I would like to be able to process them with same XSLT without using other tools, for convenience and simplicity.
So, can I process remote XML files with XSLT?

You can most certainly do this using the document function
example:
<xsl:variable name="url" select="concat('http://mysite.com/',$id)" />
<xsl:variable name="IDmeta" select="document($url)"/>
to test you can do
<xsl:copy-of select="$IDmeta"/>
to see what the format is
reference
http://www.w3schools.com/xsl/func_document.asp

Related

Providing xml data in Django template

I have a form that make xml request, after that i recieve xml respond
that look like this:
<root>
<item>
<id>1</id>
<name>name</name>
<description>description</description>
</item>
<item>
<id>2</id>
<name>name</name>
<description>description</description>
</item>
</root>
Now I want to put this data in to the table and render it in to template. Further I want use separate element. For example user have to choose one of these elements and make order. As I understand to do this, i should parse this data using some library for example lxml, then covert it to the dictionary and than render to template, am i right or there is other way to do this? Thanks a lot.

In WiX, How can I author a custom table in a fragment?

I'm working on a WiX installer using the Visual Studio 'Votive' integration.
I'm authoring a simple custom table using <CustomTable> and I want to place it in a separate file within a <Fragment>.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<CustomTable Id="CustomActionData">
<Column Id="Id" Category="Identifier" PrimaryKey="yes" Type="int" Width="4" />
<Column Id="AssemblyFile" Category="Text" Type="string" PrimaryKey="no" />
<Column Id="TypeName" Category="Text" Type="string" PrimaryKey="no" />
<Row>
<Data Column="Id">1</Data>
<Data Column="AssemblyFile">MyAssembly.dll</Data>
<Data Column="TypeName">MyAssembly.TypeName</Data>
</Row>
</CustomTable>
</Fragment>
</Wix>
The trouble is, WiX/Votive doesn't include the fragment because nothing references it. There is no such thing as a <CustomTableRef>. <Fragment> is, however, a valid parent of <CustomTable>, so there must be a way of making WiX include it.
Any suggestions? How do I reference a custom table within a fragment?
Ideally there'd be a CustomTableRef but that doesn't exist. (Feel free to file a suggestion.) So you need another Element/ElementRef pair. Try Property/PropertyRef instead.
The way this works with WiX custom actions is that a compiler extension writes the custom table rows directly so there's no authoring that needs to be linked in.

How to use complex object elements in WSO2 DSS?

I'm new to WSO2 Data Services Server and I trying to figure out how to get complex element types working correctly with the web scraper. Using the interface I seem to be able to define the object, but I'm not sure how to use it once it is defined. Below is the Data Service XML...
<data name="ComplexTypeExample">
<description>A Description</description>
<config id="GetPrices">
<property name="web_harvest_config">./samples/resources/GetPrices.xml</property>
</config>
<query id="getSonyPrices" useConfig="GetPrices">
<scraperVariable>priceInfoSony</scraperVariable>
<result element="CameraInfo" rowName="Record">
<element column="Pic" name="Pic" xsdType="string"/>
<element column="Desc" name="Desc" xsdType="string"/>
<element name="Inventory" namespace="">
<element name="Item" namespace="">
<element column="Grade" name="Grade" xsdType="string"/>
<element column="Price" name="Price" xsdType="string"/>
</element>
</element>
</result>
</query>
<operation name="getSonyPricesOperation">
<description>Gets prices of KM/Sony cameras</description>
<call-query href="getSonyPrices"/>
</operation>
</data>
What I am trying to do is figure out how to get the Inventory element to be an array of Item types. Something like this...
<Record>
<Pic>Camera.jpg</Pic>
<Desc>A camera made by some company</Desc>
<Inventory>
<Item>
<Grade>Good</Grade>
<Price>$200</Price>
</Item>
<Item>
<Grade>Not So Good</Grade>
<Price>$100</Price>
</Item>
<Item>
<Grade>Broken</Grade>
<Price>$10</Price>
</Item>
</Inventory>
</Record>
Can anyone provide some hints as to where I'm going wrong?
Looks like you have done your complex element mapping correctly according to your result set .. Are you having trouble scraping the values? If so you have to provide us with the scraping configuration, and also you have to write the xslt file also according to your complex elements.
Please refer the following guide for web scraping

Magento 1.5.01 - I am unable to load a template after overriding the customer module

This is my first post here, so please forgive me in advance :)
I've been working on overriding the Customer module for some specific
functionality depending on the user group; I want to duplicate and
append to the user registration form that targets the specific user
group.
I have successfully overridden and extended my way through the
controller, model, and block classes that I would like to use, however
when I override the block class, the layout i'm pointing to is no
longer rendered.
Here's the relevant chunk of the layout code:
<customer_account_vcreate translate="label">
<label>Customer Account Registration Form</label>
<!-- Mage_Customer -->
<remove name="right"/>
<remove name="left"/>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
<reference name="content">
<block type="customer/form_register" name="customer_form_register" template="customer/form/register.phtml">
<block type="page/html_wrapper" name="customer.form.register.fields.before" as="form_fields_before" translate="label">
<label>Form Fields Before</label>
</block>
</block>
</reference>
</customer_account_vcreate>
I know that it just points to the regular block/template right now, but even that isn't loading. The block loads just fine (I can output from the constructor), it just seems that the layout file is not being loaded anymore.
I've also tried to override the login form with similar problems, can anyone help?
Geoff
EDIT -
Here's a more complete question for the login block:
Here's my config:
<?xml version="1.0"?>
<config>
<modules>
<Izoox_Customer>
<version>1.0.1</version>
</Izoox_Customer>
</modules>
<frontend>
<routers>
<customer>
<args>
<modules>
<Izoox_Customer before="Mage_Customer">Izoox_Customer_Customer</Izoox_Customer>
</modules>
</args>
</customer>
</routers>
<layout>
<updates>
<customer>
<file>izooxcustomer.xml</file>
</customer>
</updates>
</layout>
</frontend>
<global>
<blocks>
<customer>
<rewrite><form_login>Izoox_Customer_Block_Form_Login</form_login>
</rewrite>
</customer>
</blocks>
</global>
</config>
It works when I remove the block code from the above config, except then I'm not getting any of my custom code from the block.
Above I have overridden the Customer module to use my own code here, and have overridden the customer_login block with my own block. I can see that the custom block loads by echoing out of the _prepareLayout() function, but the view file (login.phtml) doesn't seem to load. Here's the layout (izooxcustomer.xml), which also loads fine.
<customer_account_login translate="label">
<label>Customer Account Login Form</label>
<!-- Mage_Customer -->
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
<reference name="content">
<block type="customer/form_login" name="customer_form_login" template="customer/form/login.phtml"/>
</reference>
</customer_account_login>
Am I missing something, or is this just not possible?
Thanks,
Geoff
Looks like you have your main layout tag misspelled. It should be <customer_account_create>. You have a 'v' in there before create.

Any obvious flaws in this CAML Query?

I am querying a sharepoint list via the web service api. Calling the service through the API requires sending an XmlNode object that represent the CAML query. With everything else exactly the same, these are two different queries I'm attempting to send (obtained via the XmlNode's InnerXml property right before they are sent to the API):
<!-- This one works fine -->
<Query>
<Where>
<Eq>
<FieldRef Name="ID" />
<Value Type="Text">304</Value>
</Eq>
</Where>
</Query>
<!-- This one fails with a Soap exception (which I've seen before when searching
for an invalid field, but the first one calls the exact same field). -->
<Query>
<Where>
<In>
<FieldRef Name="ID" />
<Values>
<Value Type="Text">304</Value>
<Value Type="Text">303</Value>
<Value Type="Text">302</Value>
<Value Type="Text">301</Value>
</Values>
</In>
</Where>
</Query>
I'm new to CAML queries, so perhaps I'm missing something obvious about how In statements work, but all the examples I've viewed seem to have this exact format.
Which version of SharePoint are you using ? The IN element seems to be valid only in SharePoint 2010. (According to this article: http://www.lushpedia.com/post/Alternative-of-In-Clause-for-CAML-Query-for-SharePoint-2007.aspx)