Input XML
<?xml version="1.0" encoding="UTF-8" ?>
<Z_RFC_SP_POTEXT_OUT >
<ZMPO_TXT>
<item>
<LIFNR>0009002008</LIFNR>
<ZPOTEXT1>BSE-TSE Statement document is accpeted by sup3#spp2.com on 2010-04-12</ZPOTEXT1>
<ZPOTEXT2 />
<FLAG />
</item>
<item>
<LIFNR>0009002008</LIFNR>
<ZPOTEXT1>Ist Part</ZPOTEXT1>
<ZPOTEXT2 />
<FLAG />
</item>
<item>
<LIFNR>0009002008</LIFNR>
<ZPOTEXT1>2nd Part</ZPOTEXT1>
<ZPOTEXT2 />
<FLAG />
</item>
<item>
<LIFNR>0009000013</LIFNR>
<ZPOTEXT1>vComments for Obj 1hkshkshdiswyidswyidyswidysiysiysskhskchskhckchk</ZPOTEXT1>
<ZPOTEXT2 />
<FLAG />
</item>
<item>
<LIFNR>0009000017</LIFNR>
<ZPOTEXT1>vComments for Obj 1hkshkshdiswyidswyidyswidysiysiysskhskchskhckchk</ZPOTEXT1>
<ZPOTEXT2 />
<FLAG />
</item>
<item>
<LIFNR>0009000017</LIFNR>
<ZPOTEXT1>1st part</ZPOTEXT1>
<ZPOTEXT2 />
<FLAG />
</item>
<item>
<LIFNR>0009000017</LIFNR>
<ZPOTEXT1>2nd part</ZPOTEXT1>
<ZPOTEXT2 />
<FLAG />
</item>
<item>
<LIFNR>0009000022</LIFNR>
<ZPOTEXT1>INCLUDE ZPTP_TERMS_AND_CONDITIONS_2003 OBJECT TEXT ID ST</ZPOTEXT1>
<ZPOTEXT2 />
<FLAG />
</item>
<item>
<LIFNR>0009000026</LIFNR>
<ZPOTEXT1>INCLUDE ZPTP_TERMS_AND_CONDITIONS_2003 OBJECT TEXT ID ST</ZPOTEXT1>
<ZPOTEXT2 />
<FLAG />
</item>
</ZMPO_TXT>
</Z_RFC_SP_POTEXT_OUT>
I am looking for the output
<?xml version="1.0" encoding="UTF-8" ?>
<Z_RFC_SP_POTEXT_OUT >
<ZMPO_TXT>
<item>
<LIFNR>0009002008</LIFNR>
<ZPOTEXT1>BSE-TSE Statement document is accpeted by sup3#spp2.com on 2010-04-12 Ist Part 2nd Part</ZPOTEXT1>
<ZPOTEXT2 />
<FLAG />
</item>
<item>
<LIFNR>0009000013</LIFNR>
<ZPOTEXT1>vComments for Obj 1hkshkshdiswyidswyidyswidysiysiysskhskchskhckchk</ZPOTEXT1>
<ZPOTEXT2 />
<FLAG />
</item>
<item>
<LIFNR>0009000017</LIFNR>
<ZPOTEXT1>vComments for Obj 1hkshkshdiswyidswyidyswidysiysiysskhskchskhckchk 1st part 2nd part</ZPOTEXT1>
<ZPOTEXT2 />
<FLAG />
</item>
<item>
<LIFNR>0009000022</LIFNR>
<ZPOTEXT1>INCLUDE ZPTP_TERMS_AND_CONDITIONS_2003 OBJECT TEXT ID ST</ZPOTEXT1>
<ZPOTEXT2 />
<FLAG />
</item>
<item>
<LIFNR>0009000026</LIFNR>
<ZPOTEXT1>INCLUDE ZPTP_TERMS_AND_CONDITIONS_2003 OBJECT TEXT ID ST</ZPOTEXT1>
<ZPOTEXT2 />
<FLAG />
</item>
</ZMPO_TXT>
</Z_RFC_SP_POTEXT_OUT>
How to do that using xslt?
looks like a Munchian Sort can help you further. if you group the items by <LIFNR>, you should be able to drop all text in a single node.
Related
I am trying to develop a hierarchical structure from a flat file thus i need to establish parent child relationship in the desired output. Could you please suggest a method in XSLT 2.0.
Please find below the input XML which contains LEVEL and IDENTIFY tags on the basis of which i was trying to build the parent child relationship.
All the IDENTIFY tags with 'IB' should be in a separate tag like LOCATION and all the IDENTIFY tags with 'ER' should be in a separate tag like ADDRESS in output.
Input XML:
<Path>
<item>
<LEVEL>1</LEVEL>
<RANK>340</RANK>
<TYPE>T</TYPE>
<DESC>Sheet</DESC>
<NAME>I</NAME>
<IDENTIFY>IB</IDENTIFY>
</item>
<item>
<LEVEL>2</LEVEL>
<RANK/>
<TYPE>M</TYPE>
<DESC> Handler</DESC>
<NAME>D</NAME>
<IDENTIFY></IDENTIFY>
</item>
<item>
<LEVEL>2</LEVEL>
<RANK>341</RANK>
<TYPE>M</TYPE>
<DESC>handler </DESC>
<NAME>I</NAME>
<IDENTIFY>IB</IDENTIFY>
</item>
<item>
<LEVEL>3</LEVEL>
<RANK/>
<TYPE>M</TYPE>
<DESC>pdf</DESC>
<NAME>D</NAME>
<IDENTIFY></IDENTIFY>
</item>
<item>
<LEVEL>3</LEVEL>
<RANK>330</RANK>
<TYPE>M</TYPE>
<DESC>SERVO </DESC>
<NAME>L</NAME>
<IDENTIFY>ER</IDENTIFY>
</item>
<item>
<LEVEL>3</LEVEL>
<RANK>331</RANK>
<TYPE>M</TYPE>
<DESC>SENSOR</DESC>
<NAME>L</NAME>
<IDENTIFY>ER</IDENTIFY>
</item>
<item>
<LEVEL>2</LEVEL>
<RANK>342</RANK>
<TYPE>M</TYPE>
<DESC>xyz</DESC>
<NAME>I</NAME>
<IDENTIFY>IB</IDENTIFY>
</item>
<item>
<LEVEL>3</LEVEL>
<RANK>335</RANK>
<TYPE>M</TYPE>
<DESC>FILTER</DESC>
<NAME>L</NAME>
<IDENTIFY>ER</IDENTIFY>
</item>
<item>
<LEVEL>2</LEVEL>
<RANK>343</RANK>
<TYPE>M</TYPE>
<DESC>safety </DESC>
<NAME>I</NAME>
<IDENTIFY>IB</IDENTIFY>
</item>
<item>
<LEVEL>3</LEVEL>
<RANK/>
<TYPE>M</TYPE>
<DESC>doc</DESC>
<NAME>D</NAME>
<IDENTIFY></IDENTIFY>
</item>
<item>
<LEVEL>3</LEVEL>
<RANK>337</RANK>
<TYPE>M</TYPE>
<DESC>ROD </DESC>
<NAME>L</NAME>
<IDENTIFY>ER</IDENTIFY>
</item>
<item>
<LEVEL>3</LEVEL>
<RANK>338</RANK>
<TYPE>M</TYPE>
<DESC>CYL</DESC>
<NAME>L</NAME>
<IDENTIFY>ER</IDENTIFY>
</item>
<item>
<LEVEL>3</LEVEL>
<RANK>339</RANK>
<TYPE>M</TYPE>
<DESC>COMPRESSION </DESC>
<NAME>L</NAME>
<IDENTIFY>ER</IDENTIFY>
</item>
<item>
<LEVEL>2</LEVEL>
<RANK>345</RANK>
<TYPE>M</TYPE>
<DESC>Nylon</DESC>
<NAME>I</NAME>
<IDENTIFY>ER</IDENTIFY>
</item>
</Path>
Desired Output:
<LOCATION>
<LEVEL>1</LEVEL>
<RANK>340</RANK>
<TYPE>T</TYPE>
<DESC>Sheet</DESC>
<NAME>I</NAME>
</LOCATION>
<LOCATION>
<LEVEL>2</LEVEL>
<RANK/>
<TYPE>M</TYPE>
<DESC> Handler</DESC>
<NAME>D</NAME>
</LOCATION>
<LOCATION>
<LEVEL>2</LEVEL>
<RANK>341</RANK>
<TYPE>M</TYPE>
<DESC> handler </DESC>
<NAME>I</NAME>
</LOCATION>
<ADDRESS>
<LEVEL>3</LEVEL>
<RANK/>
<TYPE>M</TYPE>
<DESC>pdf</DESC>
<NAME>D</NAME>
</ADDRESS>
<ADDRESS>
<LEVEL>3</LEVEL>
<RANK>330</RANK>
<TYPE>M</TYPE>
<DESC>pqr</DESC>
<NAME>L</NAME>
</ADDRESS>
<ADDRESS>
<LEVEL>3</LEVEL>
<RANK>331</RANK>
<TYPE>M</TYPE>
<DESC>SENSOR</DESC>
<NAME>L</NAME>
</ADDRESS>
<LOCATION>
<LEVEL>2</LEVEL>
<RANK>342</RANK>
<TYPE>M</TYPE>
<DESC>xyz</DESC>
<NAME>I</NAME>
</LOCATION>
<ADDRESS>
<LEVEL>3</LEVEL>
<RANK>335</RANK>
<TYPE>M</TYPE>
<DESC>TER</DESC>
<NAME>L</NAME>
</ADDRESS>
<LOCATION>
<LEVEL>2</LEVEL>
<RANK>343</RANK>
<TYPE>M</TYPE>
<DESC>SAFE</DESC>
<NAME>I</NAME>
</LOCATION>
<ADDRESS>
<LEVEL>3</LEVEL>
<RANK/>
<TYPE>M</TYPE>
<DESC>doc</DESC>
<NAME>D</NAME>
</ADDRESS>
<ADDRESS>
<LEVEL>3</LEVEL>
<RANK>337</RANK>
<TYPE>M</TYPE>
<DESC>RST/DESC>
<NAME>L</NAME>
</ADDRESS>
<ADDRESS>
<LEVEL>3</LEVEL>
<RANK>338</RANK>
<TYPE>M</TYPE>
<DESC>CYL</DESC>
<NAME>L</NAME>
</ADDRESS>
<ADDRESS>
<LEVEL>3</LEVEL>
<RANK>339</RANK>
<TYPE>M</TYPE>
<DESC>COMP</DESC>
<NAME>L</NAME>
</ADDRESS>
<LOCATION>
<LEVEL>2</LEVEL>
<RANK>345</RANK>
<TYPE>M</TYPE>
<DESC>Nyl</DESC>
<NAME>I</NAME>
</LOCATION>
I'm trying to create a program using gtkmm3 and the Application::set_menubar method. I can create the menu, but when I run the program, all of the items in the menus are greyed out. I have scoured both the glibmm and glib libraries looking for ways to enable (and later disable/hide) menu items, and I cannot find any function or method to do it. How do I fix this?
I'm compiling with:
g++ -std=c++0x -o program program.cpp `pkg-config --cflags --libs gtkmm-3.0`
Code code is as follows:
// vim:set ai et shiftwidth=4 softtabstop=4 :
#include <gtkmm.h>
#include <glibmm.h>
#include <giomm/menulinkiter.h>
class ApplicationMain{
private:
Glib::RefPtr<Gtk::Application> app;
Glib::RefPtr<Gio::Menu> mnuMenu;
/// Builds menu and puts menu actions into the application's action map
void createMenu();
/// Recursive method that iterates over the supplied MenuModel and
/// extracts actions into the application's action map
void extractMenuActions(const Glib::RefPtr<Gio::MenuModel> &model);
public:
ApplicationMain(int argc, char **argv);
~ApplicationMain();
int run();
};
using namespace std;
/// Container for menu xml data
struct MenuStringContainer{
static const char *string;
};
/// Builds menu and puts menu actions into the application's action map
void ApplicationMain::createMenu(){
// Build menu from xml data
Glib::RefPtr<Gtk::Builder> builder = Gtk::Builder::create_from_string(MenuStringContainer::string);
mnuMenu = Glib::RefPtr<Gio::Menu>::cast_dynamic(builder->get_object("menubar"));
// Extract actions from menu model and add them to our action map
extractMenuActions(Glib::RefPtr<Gio::MenuModel>::cast_static(mnuMenu));
}
void ApplicationMain::extractMenuActions(const Glib::RefPtr<Gio::MenuModel> &model){
// Get the number of items in this menu model
gint count = g_menu_model_get_n_items(model->gobj());
// Iterate over the items in this model
for(gint i = 0; i < count; i++){
// Iterate over and recurse into the links in this menu model item
auto iter = model->iterate_item_links(i);
while(iter->next()){
extractMenuActions(iter->get_value());
}
try{
// Get the action for this item. Throws std::bad_cast if the cast can't be made
Glib::Variant<Glib::ustring> act = Glib::VariantBase::cast_dynamic<Glib::Variant<Glib::ustring>>(
model->get_item_attribute(i, Gio::MENU_ATTRIBUTE_ACTION, Glib::Variant<Glib::ustring>::variant_type())
);
// If this action is valid, get the action name and add it to the action map
if(act.gobj() != nullptr){
Glib::ustring actName = act.get();
app->add_action(Gio::SimpleAction::create(actName));
}
} catch(std::bad_cast &){
}
}
}
ApplicationMain::ApplicationMain(int argc, char **argv){
app = Gtk::Application::create(argc, argv, "com.angellistaliuu.jaguar.Chummer5");
chdir(Gio::File::create_for_commandline_arg(argv[0])->get_basename().c_str());
}
ApplicationMain::~ApplicationMain(){
}
int ApplicationMain::run(){
if(app->register_application()){
createMenu();
app->set_menubar(mnuMenu);
{
Gtk::ApplicationWindow *frm = new Gtk::ApplicationWindow();
// Allow pointer to be unreferenced when this scope ends
Glib::RefPtr<Gtk::ApplicationWindow> frmPtr(frm);
app->run(*frm);
}
} else {
app->activate();
}
}
int main(int argc, char **argv){
ApplicationMain appMain(argc, argv);
return appMain.run();
}
// XML data for application menu
const char *MenuStringContainer::string = R"rawstring(
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<menu id="menubar">
<submenu>
<attribute name="label">_File</attribute>
<section>
<item>
<attribute name="label">_New Character</attribute>
<attribute name="action">file.newchar</attribute>
</item>
<item>
<attribute name="label">New _Critter</attribute>
<attribute name="action">file.newcrit</attribute>
</item>
<item>
<attribute name="label">_Open</attribute>
<attribute name="action">file.open</attribute>
</item>
</section>
<section>
<item>
<attribute name="label">_Print</attribute>
<attribute name="action">file.print</attribute>
</item>
<item>
<attribute name="label">Print _Multiple</attribute>
<attribute name="action">file.printmultiple</attribute>
</item>
<item>
<attribute name="label">Print Setup</attribute>
<attribute name="action">file.printsetup</attribute>
</item>
</section>
<section id="mru">
<item>
<attribute name="label">[StickyMRU0]</attribute>
<attribute name="action">file.smru0</attribute>
</item>
<item>
<attribute name="label">[StickyMRU1]</attribute>
<attribute name="action">file.smru1</attribute>
</item>
<item>
<attribute name="label">[StickyMRU2]</attribute>
<attribute name="action">file.smru2</attribute>
</item>
<item>
<attribute name="label">[StickyMRU3]</attribute>
<attribute name="action">file.smru3</attribute>
</item>
<item>
<attribute name="label">[StickyMRU4]</attribute>
<attribute name="action">file.smru4</attribute>
</item>
<item>
<attribute name="label">[StickyMRU5]</attribute>
<attribute name="action">file.smru5</attribute>
</item>
<item>
<attribute name="label">[StickyMRU6]</attribute>
<attribute name="action">file.smru6</attribute>
</item>
<item>
<attribute name="label">[StickyMRU7]</attribute>
<attribute name="action">file.smru7</attribute>
</item>
<item>
<attribute name="label">[StickyMRU8]</attribute>
<attribute name="action">file.smru8</attribute>
</item>
<item>
<attribute name="label">[StickyMRU9]</attribute>
<attribute name="action">file.smru9</attribute>
</item>
<item>
<attribute name="label">[MRU0]</attribute>
<attribute name="action">file.mru0</attribute>
</item>
<item>
<attribute name="label">[MRU1]</attribute>
<attribute name="action">file.mru1</attribute>
</item>
<item>
<attribute name="label">[MRU2]</attribute>
<attribute name="action">file.mru2</attribute>
</item>
<item>
<attribute name="label">[MRU3]</attribute>
<attribute name="action">file.mru3</attribute>
</item>
<item>
<attribute name="label">[MRU4]</attribute>
<attribute name="action">file.mru4</attribute>
</item>
<item>
<attribute name="label">[MRU5]</attribute>
<attribute name="action">file.mru5</attribute>
</item>
<item>
<attribute name="label">[MRU6]</attribute>
<attribute name="action">file.mru6</attribute>
</item>
<item>
<attribute name="label">[MRU7]</attribute>
<attribute name="action">file.mru7</attribute>
</item>
<item>
<attribute name="label">[MRU8]</attribute>
<attribute name="action">file.mru8</attribute>
</item>
<item>
<attribute name="label">[MRU9]</attribute>
<attribute name="action">file.mru9</attribute>
</item>
</section>
<section>
<item>
<attribute name="label">E_xit</attribute>
<attribute name="action">file.exit</attribute>
</item>
</section>
</submenu>
<submenu>
<attribute name="label">_Tools</attribute>
<section>
<item>
<attribute name="label">_Dice Roller</attribute>
<attribute name="action">tools.roller</attribute>
</item>
</section>
<section>
<item>
<attribute name="label">_Options</attribute>
<attribute name="action">tools.options</attribute>
</item>
<item>
<attribute name="label">Check for Updates</attribute>
<attribute name="action">tools.updates</attribute>
</item>
<item>
<attribute name="label">Omae</attribute>
<attribute name="action">tools.omae</attribute>
</item>
</section>
</submenu>
<submenu>
<attribute name="label">_Windows</attribute>
<section>
<item>
<attribute name="label">_New Window</attribute>
<attribute name="action">windows.new</attribute>
</item>
<item>
<attribute name="label">C_lose All</attribute>
<attribute name="action">windows.closeall</attribute>
</item>
</section>
<section id="windowlist">
</section>
</submenu>
<submenu>
<attribute name="label">_Help</attribute>
<section>
<section>
<item>
<attribute name="label">Chummer Wiki</attribute>
<attribute name="action">help.chummerwiki</attribute>
</item>
</section>
<item>
<attribute name="label">_Revision History</attribute>
<attribute name="action">help.revisionhistory</attribute>
</item>
<item>
<attribute name="label">_Dumpshock Thread</attribute>
<attribute name="action">help.dumpshockthread</attribute>
</item>
<item>
<attribute name="label">_About...</attribute>
<attribute name="action">help.about</attribute>
</item>
</section>
</submenu>
</menu>
</interface>
)rawstring"; //"(
You are calling register_application() manually, rather than letting GtkApplication/GApplication do that for you. You probably did that to avoid this warning, which I think is the main clue, because the gtkmm examples never need to do that:
(a.out:24959): Gtk-CRITICAL **: gtk_application_set_menubar: assertion 'g_application_get_is_registered (G_APPLICATION (application))' failed
I have reduced your test case down to a simpler test case with no class definition and no use of GtkBuilder, and now I guess the problem is probably that you are adding these actions, or the menu, too early, though I'm not sure exactly what is not yet set up properly. I can post that test case here, if you like.
For instance, this example works, but notice that it adds the menu and its actions in the derived Gtk::Application's on_startup():
https://git.gnome.org/browse/gtkmm-documentation/tree/examples/book/application/app_and_win_menus/exampleapplication.cc#n32
Deriving a Gtk::Application is the more correct structure anyway, allowing the app to do the right thing at the right time. GtkApplication is a rather awkward and unforgiving API, in my opinion, so I wouldn't stray from the path.
Incidentally, it's also rather confusing to define an ApplicationMain class that doesn't derive from Gtk::Application. And you should avoid using RefPtr<> with a widget (Gtk::ApplicationWindow) class. You should never need to do any referencing or unreferencing of widgets in your application code.
I try to set String body, having cut from it the piece, with the the regular expression, as follows:
<setBody>
<simple>${body} regex '?(:.xml xsi:type="xsd:string">(.*[\s\S]*?)..xml>)'</simple>
</setBody>
it is compiled normally but started with an error:
org.apache.cxf.interceptor.Fault: javax.xml.transform.TransformerException: com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: Illegal processing instruction target ("xml"); xml (case insensitive) is reserved by the specs.
at [row,col {unknown-source}]: [6,7]
also I rty to do this with
<transform> ... </transform>
and the same error appears while running.
Please provide me the simple way to transform the body String in spring DSL by cutting it.
I want to cut xml data from soap plain request:
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:SMSServiceControllerwsdl">
<soapenv:Header/>
<soapenv:Body>
<urn:sendMessages soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<xml xsi:type="xsd:string">
<?xml version="1.0" encoding="UTF-8"?>
<Structure>
<Array name="messageArray">
<Structure>
<Value name="id">
<Type>String</Type>
<Data>ИД СООБЩЕНИЯ 1</Data>
</Value>
<Value name="phone">
<Type>String</Type>
<Data>ТЕЛЕФОН 1</Data>
</Value>
<Value name="text">
<Type>String</Type>
<Data>ТЕКСТ 1</Data>
</Value>
</Structure>
<Structure>
<Value name="id">
<Type>String</Type>
<Data>ИД СООБЩЕНИЯ 2</Data>
</Value>
<Value name="phone">
<Type>String</Type>
<Data>ТЕЛЕФОН 2</Data>
</Value>
<Value name="text">
<Type>String</Type>
<Data>ТЕКСТ 2</Data>
</Value>
</Structure>
</Array>
</Structure>
</xml>
<systemName xsi:type="xsd:string">awis</systemName>
</urn:sendMessages>
</soapenv:Body>
</soapenv:Envelope>
Use a splitter with an XPath expression such as:
<split>
<xpath>//Structure/Array/Structure</xpath>
<log message="split: ${body}"/>
</split>
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
Suppose I have some XML like this:
<section name="SampleSection">
<item name="ScoredItem1">
<attributes>
<scored data_type="boolean" value="true"/>
</attributes>
</item>
<item name="UnscoredItem1">
<attributes>
<scored data_type="boolean" value="false"/>
</attributes>
</item>
<item key="(3272fbb5:22)" name="ScoredItem2">
<attributes>
<scored data_type="boolean" value="true"/>
</attributes>
</item>
</section>
Now, I know, using XSLT, I can count the items that have a scored attribute like this:
<xsl:variable name="scoredItems" select="item/attributes/scored"/>
<xsl:value-of select="count($scoredItems)"/>
This will give me a value of 3, of course.
Suppose I only want to count those items for which scored is true. How do I do that using XSLT? (This should return a value of 2 for this example.
Do it like this:
<xsl:variable name="scoredItems"
select=
"item/attributes/scored[#value='true']"/>