XSLT Transform doesn’t work until I remove root node

The problem: your XML puts its elements in a namespace. Solution: declare the same namespace in your stylesheet, assign it a prefix and use that prefix to address the elements in the source XML: XSLT 1.0 <xsl:stylesheet version=”1.0″ xmlns:xsl=”http://www.w3.org/1999/XSL/Transform” xmlns:met=”www.metoffice.gov.uk/xml/metoRegionalFcst” exclude-result-prefixes=”met”> <xsl:template match=”https://stackoverflow.com/”> <html> <body> <xsl:value-of select=”met:RegionalFcst/met:FcstPeriods/met:Period/met:Paragraph[@title=”Headline:”]”/> </body> </html> </xsl:template> </xsl:stylesheet>

What’s the difference between xsd:include and xsd:import?

The fundamental difference between include and import is that you must use import to refer to declarations or definitions that are in a different target namespace and you must use include to refer to declarations or definitions that are (or will be) in the same target namespace. Source: https://web.archive.org/web/20070804031046/http://xsd.stylusstudio.com/2002Jun/post08016.htm

xmlns, xmlns:xsi, xsi:schemaLocation, and targetNamespace?

Namespace related attributes in XML and XML Schema (XSD) xmlns is part of the W3C Namespaces in XML Recommendation: The prefix xmlns is used only to declare namespace bindings and is by definition bound to the namespace name http://www.w3.org/2000/xmlns/. In your example, it declares that http://maven.apache.org/POM/4.0.0 is the default namespace for the elements in your … Read more

Using a custom typeface in Android

Yes It is possible. You have to create a custom view which extends text view. In attrs.xml in values folder: <resources> <declare-styleable name=”MyTextView”> <attr name=”first_name” format=”string”/> <attr name=”last_name” format=”string”/> <attr name=”ttf_name” format=”string”/> </declare-styleable> </resources> In main.xml: <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:lht=”http://schemas.android.com/apk/res/com.lht” android:orientation=”vertical” android:layout_width=”fill_parent” android:layout_height=”fill_parent” > <TextView android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:text=”Hello”/> <com.lht.ui.MyTextView android:id=”@+id/MyTextView” android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:text=”Hello friends” lht:ttf_name=”ITCBLKAD.TTF” /> … Read more

How to parse XML to R data frame

Data in XML format are rarely organized in a way that would allow the xmlToDataFrame function to work. You’re better off extracting everything in lists and then binding the lists together in a data frame: require(XML) data <- xmlParse(“http://forecast.weather.gov/MapClick.php?lat=29.803&lon=-82.411&FcstType=digitalDWML”) xml_data <- xmlToList(data) In the case of your example data, getting location and start time is … Read more

How to make type depend on attribute value using Conditional Type Assignment

You can do this using XSD 1.1’s Conditional Type Assignment: <?xml version=”1.0″ encoding=”UTF-8″?> <xs:schema xmlns:xs=”http://www.w3.org/2001/XMLSchema” xmlns:vc=”http://www.w3.org/2007/XMLSchema-versioning” elementFormDefault=”qualified” vc:minVersion=”1.1″> <xs:element name=”listOfA”> <xs:complexType> <xs:sequence> <xs:element name=”a” maxOccurs=”unbounded”> <xs:alternative test=”@type = 1″ type=”a1Type”/> <xs:alternative test=”@type = 2″ type=”a2Type”/> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:complexType name=”a1Type”> <xs:sequence> <xs:element name=”name”/> <xs:element name=”surname”/> </xs:sequence> </xs:complexType> <xs:complexType name=”a2Type”> <xs:sequence> <xs:element name=”name”/> <xs:element name=”id”/> … Read more

How to fix error: The markup in the document following the root element must be well-formed

General case The markup in the document following the root element must be well-formed. This error indicates that your XML has markup following the root element. In order to be well-formed, XML must have exactly one root element, and there can be no further markup following the single root element. One root element example (GOOD) … Read more

How to reference a local XML Schema file correctly?

Add one more slash after file:// in the value of xsi:schemaLocation. (You have two; you need three. Think protocol://host/path where protocol is ‘file’ and host is empty here, yielding three slashes in a row.) You can also eliminate the double slashes along the path. I believe that the double slashes help with file systems that … Read more